From a49d5d30fe485eb403a4c55db88d3a4f7eaf6fe3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 5 Feb 2016 18:41:23 -0400 Subject: [PATCH] fix handling of unspecified attributes (particularly for annex.largefiles) --- Git/CheckAttr.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Git/CheckAttr.hs b/Git/CheckAttr.hs index 465bbbad30..b94bc0ee16 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 = "!"