* Run annex.thawcontent-command before deleting an object file,
in case annex.freezecontent-command did something that would prevent
deletion.
+ * Propagate nonzero exit status from git ls-files when a specified
+ file does not exist, or a specified directory does not contain
+ any files checked into git.
-- Joey Hess <id@joeyh.name> Wed, 23 Feb 2022 14:14:09 -0400
(fs, cleanup) <- inRepo $ LsFiles.inRepoDetails os [toRawFilePath p]
r <- case fs of
[f] -> do
- void $ liftIO $ cleanup
+ propagateLsFilesError cleanup
fst <$> getfiles ((SeekInput [p], f):c) ps
[] -> do
- void $ liftIO $ cleanup
+ propagateLsFilesError cleanup
fst <$> getfiles c ps
_ -> do
- void $ liftIO $ cleanup
+ propagateLsFilesError cleanup
giveup needforce
return (r, pure True)
withFilesInGitAnnexNonRecursive _ _ _ NoWorkTreeItems = noop
checktimelimit <- mkCheckTimeLimit
(fs, cleanup) <- listfs
go matcher checktimelimit fs
- liftIO $ void cleanup
+ propagateLsFilesError cleanup
where
go _ _ [] = return ()
go matcher checktimelimit (v@(_si, f):rest) = checktimelimit noop $ do
)
join (liftIO (wait mdprocessertid))
join (liftIO (wait processertid))
- liftIO $ void cleanup
+ propagateLsFilesError cleanup
where
finisher mi oreader checktimelimit = liftIO oreader >>= \case
Just ((si, f), content) -> checktimelimit (liftIO discard) $ do
cleanup
liftIO $ exitWith $ ExitFailure 101
else a
+
+propagateLsFilesError :: IO Bool -> Annex ()
+propagateLsFilesError cleanup =
+ unlessM (liftIO cleanup) $
+ Annex.incError
[[!meta author=yoh]]
[[!tag projects/datalad]]
+
+> [[fixed|done]] --[[Joey]]
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2022-02-28T16:32:08Z"
+ content="""
+I've fixed it to propagate the non-zero exit status from git ls-files.
+
+The git ls-files message still goes to stderr, not to
+--json-error-messages, the same as any stderr output by a git command
+that git-annex runs. And this is actually not a behavior change;
+the old git-annex output of "not found" did not get included in
+--json-error-messages either:
+
+ joey@darkstar:/tmp/mmm>/usr/bin/git-annex drop dne foo --json --json-error-messages
+ git-annex: dne not found
+ {"command":"drop","wanted":[],"note":"unsafe\nCould only verify the existence of 0 out of 1 necessary copy\n(Use --force to override this check, or adjust numcopies.)","success":false,"input":["foo"],"key":"SHA256E-s3--98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4","error-messages":[],"file":"foo/bar"}
+ drop: 2 failed
+
+Bear in mind that --json-error-messages
+is about errors encountered while processing a particular file that it
+outputs a json record for. This error comes before it starts processing any
+particular file. Also, of course, error messages output by git commands
+are never included in --json-error-messages.
+
+I think it might be a good idea to add an actual API for detecting when
+there is this kind of problem, so datalad does not have to parse
+error messages (which could easily change). But that would need to be a
+separate discussion.
+"""]]