diff options
author | 2017-06-01 11:40:47 -0400 | |
---|---|---|
committer | 2017-06-01 11:40:47 -0400 | |
commit | 9a9aa7cb83b8338331a1fa61e9b8dd2b21b2c538 (patch) | |
tree | 0411d7b1ccfa84f0ee00cdbbdfac0081442bfd25 | |
parent | 85e62f678cbd6c69edee9a77cd28160483c9257a (diff) |
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.
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | CmdLine/Seek.hs | 15 | ||||
-rw-r--r-- | doc/bugs/Adding_metadata.mdwn | 2 |
3 files changed, 14 insertions, 6 deletions
@@ -9,6 +9,9 @@ git-annex (6.20170520) UNRELEASED; urgency=medium transfers. * Avoid concurrent git-config setting problem when running concurrent 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 diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs index 0afb0e66a..66cd985f4 100644 --- a/CmdLine/Seek.hs +++ b/CmdLine/Seek.hs @@ -41,7 +41,9 @@ withFilesInGitNonRecursive needforce a params = ifM (Annex.getState Annex.force) ( withFilesInGit a params , if null params then giveup needforce - else seekActions $ prepFiltered a (getfiles [] params) + else do + checkFileOrDirectoryExists params + seekActions $ prepFiltered a (getfiles [] params) ) where 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 a params = do - forM_ params $ \p -> - unlessM (isJust <$> liftIO (catchMaybeIO $ getSymbolicLinkStatus p)) $ do - toplevelWarning False (p ++ " not found") - Annex.incError + checkFileOrDirectoryExists params inRepo $ \g -> concat . concat <$> forM (segmentXargsOrdered params) (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 f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f diff --git a/doc/bugs/Adding_metadata.mdwn b/doc/bugs/Adding_metadata.mdwn index 1869baeb4..e413e7e82 100644 --- a/doc/bugs/Adding_metadata.mdwn +++ b/doc/bugs/Adding_metadata.mdwn @@ -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/ - +> [fixed|done]] --[[Joey]] |