normalise associated files
Sometimes ./file will be passed in, and sometimes file; need to treat these the same.
This commit is contained in:
parent
acb285d324
commit
97d670b0d5
2 changed files with 6 additions and 4 deletions
|
@ -54,16 +54,18 @@ changeAssociatedFiles key transform = do
|
|||
|
||||
removeAssociatedFile :: Key -> FilePath -> Annex [FilePath]
|
||||
removeAssociatedFile key file = do
|
||||
fs <- changeAssociatedFiles key $ filter (/= file)
|
||||
fs <- changeAssociatedFiles key $ filter (/= normalise file)
|
||||
when (null fs) $
|
||||
logStatus key InfoMissing
|
||||
return fs
|
||||
|
||||
addAssociatedFile :: Key -> FilePath -> Annex [FilePath]
|
||||
addAssociatedFile key file = changeAssociatedFiles key $ \files ->
|
||||
if file `elem` files
|
||||
if file' `elem` files
|
||||
then files
|
||||
else file:files
|
||||
else file':files
|
||||
where
|
||||
file' = normalise file
|
||||
|
||||
{- Checks if a file in the tree, associated with a key, has not been modified.
|
||||
-
|
||||
|
|
|
@ -175,7 +175,7 @@ toDirectGen :: Key -> FilePath -> Annex (Maybe (Annex ()))
|
|||
toDirectGen k f = do
|
||||
loc <- inRepo $ gitAnnexLocation k
|
||||
createContentDir loc -- thaws directory too
|
||||
locs <- filter (/= f) <$> addAssociatedFile k f
|
||||
locs <- filter (/= normalise f) <$> addAssociatedFile k f
|
||||
case locs of
|
||||
[] -> ifM (liftIO $ doesFileExist loc)
|
||||
( return $ Just $ do
|
||||
|
|
Loading…
Reference in a new issue