aboutsummaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-05 18:41:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-05 18:41:23 -0400
commit97841eb5cccd87183d372ccbb7bef0944d05bbdf (patch)
tree7f6162f7c72b18a821c550f1d17a60eab1d83e69 /Git
parent5e5997b483e34081206be6ba4c42e9bd0427683a (diff)
fix handling of unspecified attributes (particularly for annex.largefiles)
Diffstat (limited to 'Git')
-rw-r--r--Git/CheckAttr.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Git/CheckAttr.hs b/Git/CheckAttr.hs
index 465bbbad3..b94bc0ee1 100644
--- a/Git/CheckAttr.hs
+++ b/Git/CheckAttr.hs
@@ -38,12 +38,14 @@ checkAttrStart attrs repo = do
checkAttrStop :: CheckAttrHandle -> IO ()
checkAttrStop (h, _, _, _) = CoProcess.stop h
-{- Gets an attribute of a file. -}
+{- Gets an attribute of a file. When the attribute is not specified,
+ - returns "" -}
checkAttr :: CheckAttrHandle -> Attr -> FilePath -> IO String
checkAttr (h, attrs, oldgit, currdir) want file = do
pairs <- CoProcess.query h send (receive "")
let vals = map snd $ filter (\(attr, _) -> attr == want) pairs
case vals of
+ ["unspecified"] -> return ""
[v] -> return v
_ -> error $ "unable to determine " ++ want ++ " attribute of " ++ file
where
@@ -93,5 +95,7 @@ checkAttr (h, attrs, oldgit, currdir) want file = do
getattrvalues (_filename:attr:val:rest) c = getattrvalues rest ((attr,val):c)
getattrvalues _ c = c
+{- User may enter this to override a previous attr setting, when they wish
+ - to not specify an attr for some files. -}
unspecifiedAttr :: String
unspecifiedAttr = "!"