error when metadata set is used with file that does not exist
When setting metadata of a file that did not exist, no error message was displayed, unlike getting metadata and most other git-annex commands. Fixed this oversight. Note that, if the file exists but is not annexed, there's no error. This is the same behavior as other git-annex commands. This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
970fd765d7
commit
bb060f000f
3 changed files with 14 additions and 6 deletions
|
@ -9,6 +9,9 @@ git-annex (6.20170520) UNRELEASED; urgency=medium
|
||||||
transfers.
|
transfers.
|
||||||
* Avoid concurrent git-config setting problem when running concurrent
|
* Avoid concurrent git-config setting problem when running concurrent
|
||||||
threads.
|
threads.
|
||||||
|
* metadata: When setting metadata of a file that did not exist,
|
||||||
|
no error message was displayed, unlike getting metadata and most other
|
||||||
|
git-annex commands. Fixed this oversight.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 24 May 2017 14:03:40 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 24 May 2017 14:03:40 -0400
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,9 @@ withFilesInGitNonRecursive needforce a params = ifM (Annex.getState Annex.force)
|
||||||
( withFilesInGit a params
|
( withFilesInGit a params
|
||||||
, if null params
|
, if null params
|
||||||
then giveup needforce
|
then giveup needforce
|
||||||
else seekActions $ prepFiltered a (getfiles [] params)
|
else do
|
||||||
|
checkFileOrDirectoryExists params
|
||||||
|
seekActions $ prepFiltered a (getfiles [] params)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
getfiles c [] = return (reverse c)
|
getfiles c [] = return (reverse c)
|
||||||
|
@ -243,12 +245,15 @@ seekActions gen = mapM_ commandAction =<< gen
|
||||||
|
|
||||||
seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath]
|
seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath]
|
||||||
seekHelper a params = do
|
seekHelper a params = do
|
||||||
forM_ params $ \p ->
|
checkFileOrDirectoryExists params
|
||||||
unlessM (isJust <$> liftIO (catchMaybeIO $ getSymbolicLinkStatus p)) $ do
|
|
||||||
toplevelWarning False (p ++ " not found")
|
|
||||||
Annex.incError
|
|
||||||
inRepo $ \g -> concat . concat <$> forM (segmentXargsOrdered params)
|
inRepo $ \g -> concat . concat <$> forM (segmentXargsOrdered params)
|
||||||
(runSegmentPaths (\fs -> Git.Command.leaveZombie <$> a fs g))
|
(runSegmentPaths (\fs -> Git.Command.leaveZombie <$> a fs g))
|
||||||
|
|
||||||
|
checkFileOrDirectoryExists :: [FilePath] -> Annex ()
|
||||||
|
checkFileOrDirectoryExists ps = forM_ ps $ \p ->
|
||||||
|
unlessM (isJust <$> liftIO (catchMaybeIO $ getSymbolicLinkStatus p)) $ do
|
||||||
|
toplevelWarning False (p ++ " not found")
|
||||||
|
Annex.incError
|
||||||
|
|
||||||
notSymlink :: FilePath -> IO Bool
|
notSymlink :: FilePath -> IO Bool
|
||||||
notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f
|
notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f
|
||||||
|
|
|
@ -15,4 +15,4 @@ v5.20150710-g8fd705
|
||||||
|
|
||||||
We use git-annex for our open-source !FreeSurfer software and find very helpful indeed. Thank you. https://surfer.nmr.mgh.harvard.edu/
|
We use git-annex for our open-source !FreeSurfer software and find very helpful indeed. Thank you. https://surfer.nmr.mgh.harvard.edu/
|
||||||
|
|
||||||
|
> [fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue