fix handling of unspecified attributes (particularly for annex.largefiles)
This commit is contained in:
parent
d25efeda6a
commit
a49d5d30fe
1 changed files with 5 additions and 1 deletions
|
@ -38,12 +38,14 @@ checkAttrStart attrs repo = do
|
||||||
checkAttrStop :: CheckAttrHandle -> IO ()
|
checkAttrStop :: CheckAttrHandle -> IO ()
|
||||||
checkAttrStop (h, _, _, _) = CoProcess.stop h
|
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 :: CheckAttrHandle -> Attr -> FilePath -> IO String
|
||||||
checkAttr (h, attrs, oldgit, currdir) want file = do
|
checkAttr (h, attrs, oldgit, currdir) want file = do
|
||||||
pairs <- CoProcess.query h send (receive "")
|
pairs <- CoProcess.query h send (receive "")
|
||||||
let vals = map snd $ filter (\(attr, _) -> attr == want) pairs
|
let vals = map snd $ filter (\(attr, _) -> attr == want) pairs
|
||||||
case vals of
|
case vals of
|
||||||
|
["unspecified"] -> return ""
|
||||||
[v] -> return v
|
[v] -> return v
|
||||||
_ -> error $ "unable to determine " ++ want ++ " attribute of " ++ file
|
_ -> error $ "unable to determine " ++ want ++ " attribute of " ++ file
|
||||||
where
|
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 (_filename:attr:val:rest) c = getattrvalues rest ((attr,val):c)
|
||||||
getattrvalues _ c = 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 :: String
|
||||||
unspecifiedAttr = "!"
|
unspecifiedAttr = "!"
|
||||||
|
|
Loading…
Reference in a new issue