move unspecifiedAttr check to checkAttr
It just so happens that everywhere that checks attrs other than annex.largefiles parses the value further, and failed to parse unspecifiedAttr in a way that behaved the same as if nothing was set. So this is not a bug fix or behavior change. What it does so is prevent future uses of checkAttr from needing to remember to handle checking for this edge case. Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
parent
38153ad340
commit
ae98fb1b31
2 changed files with 6 additions and 4 deletions
|
@ -29,8 +29,11 @@ annexAttrs =
|
|||
]
|
||||
|
||||
checkAttr :: Git.Attr -> RawFilePath -> Annex String
|
||||
checkAttr attr file = withCheckAttrHandle $ \h ->
|
||||
liftIO $ Git.checkAttr h attr file
|
||||
checkAttr attr file = withCheckAttrHandle $ \h -> do
|
||||
r <- liftIO $ Git.checkAttr h attr file
|
||||
if r == Git.unspecifiedAttr
|
||||
then return ""
|
||||
else return r
|
||||
|
||||
checkAttrs :: [Git.Attr] -> RawFilePath -> Annex [String]
|
||||
checkAttrs attrs file = withCheckAttrHandle $ \h ->
|
||||
|
|
|
@ -43,7 +43,6 @@ import Git.FilePath
|
|||
import Types.Remote (RemoteConfig)
|
||||
import Types.ProposedAccepted
|
||||
import Annex.CheckAttr
|
||||
import Git.CheckAttr (unspecifiedAttr)
|
||||
import qualified Git.Config
|
||||
#ifdef WITH_MAGICMIME
|
||||
import Annex.Magic
|
||||
|
@ -233,7 +232,7 @@ largeFilesMatcher = go =<< getGitConfigVal' annexLargeFiles
|
|||
return $ const $ return matcher
|
||||
go v = return $ \file -> do
|
||||
expr <- checkAttr "annex.largefiles" file
|
||||
if null expr || expr == unspecifiedAttr
|
||||
if null expr
|
||||
then case v of
|
||||
HasGlobalConfig (Just expr') ->
|
||||
mkmatcher expr' "git-annex config"
|
||||
|
|
Loading…
Reference in a new issue