when workTreeItems finds a problem with a parameter, don't go on to process it

Part of workTreeItems is trying detect a case
where git porcelain refuses to process a file, and where
git ls-files silently outputs nothing. But, it's hard to perfectly
replicate git's behavior, and besides, git's behavior could change.
So it could be that we warn, but then git ls-files does not skip over
it, and so git-annex also processes it after warning about it.

So, if we think we have a problem with a parameter, display the warning,
and skip processing it at all.

Implementing this was complicated by needing to handle the case where
all command-line parameters get filtered out this way. Which is
different than the case where there are none, because we don't want to
operate on all files in this new case..
This commit is contained in:
Joey Hess 2020-08-06 13:47:45 -04:00
parent 8312cac018
commit 5d380c6c5c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 121 additions and 41 deletions

View file

@ -635,7 +635,7 @@ seekSyncContent _ [] _ = return False
seekSyncContent o rs currbranch = do
mvar <- liftIO newEmptyMVar
bloom <- case keyOptions o of
Just WantAllKeys -> Just <$> genBloomFilter (seekworktree mvar [])
Just WantAllKeys -> Just <$> genBloomFilter (seekworktree mvar (WorkTreeItems []))
_ -> case currbranch of
(Just origbranch, Just adj) | adjustmentHidesFiles adj -> do
l <- workTreeItems' (AllowHidden True) ww (contentOfOption o)
@ -648,7 +648,7 @@ seekSyncContent o rs currbranch = do
withKeyOptions' (keyOptions o) False
(return (commandAction . gokey mvar bloom))
(const noop)
[]
(WorkTreeItems [])
waitForAllRunningCommandActions
liftIO $ not <$> isEmptyMVar mvar
where