Fix a bug in find --branch in the previous version
inAnnex check was lost for that code path. To avoid more such mistakes, made withKeyOptions check it when the AnnexedFileSeeker specifies.
This commit is contained in:
parent
2d771a7d32
commit
00865cdae8
12 changed files with 20 additions and 14 deletions
|
@ -7,6 +7,7 @@ git-annex (8.20200720.2) UNRELEASED; urgency=medium
|
||||||
* Fix a hang when using git-annex with an old openssh 7.2p2, which had
|
* Fix a hang when using git-annex with an old openssh 7.2p2, which had
|
||||||
some weird inheriting of ssh FDs by sshd. Bug was introduced in
|
some weird inheriting of ssh FDs by sshd. Bug was introduced in
|
||||||
git-annex version 7.20200202.7.
|
git-annex version 7.20200202.7.
|
||||||
|
* Fix a bug in find --branch in the previous version.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 21 Jul 2020 12:58:30 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 21 Jul 2020 12:58:30 -0400
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ batchAnnexedFilesMatching fmt seeker = batchFilesMatching fmt $
|
||||||
whenAnnexed $ \f k -> case checkContentPresent seeker of
|
whenAnnexed $ \f k -> case checkContentPresent seeker of
|
||||||
Just v -> do
|
Just v -> do
|
||||||
present <- inAnnex k
|
present <- inAnnex k
|
||||||
if (present == v)
|
if present == v
|
||||||
then startAction seeker f k
|
then startAction seeker f k
|
||||||
else return Nothing
|
else return Nothing
|
||||||
Nothing -> startAction seeker f k
|
Nothing -> startAction seeker f k
|
||||||
|
|
|
@ -166,21 +166,27 @@ withNothing _ _ = giveup "This command takes no parameters."
|
||||||
withKeyOptions
|
withKeyOptions
|
||||||
:: Maybe KeyOptions
|
:: Maybe KeyOptions
|
||||||
-> Bool
|
-> Bool
|
||||||
|
-> AnnexedFileSeeker
|
||||||
-> ((Key, ActionItem) -> CommandSeek)
|
-> ((Key, ActionItem) -> CommandSeek)
|
||||||
-> ([WorkTreeItem] -> CommandSeek)
|
-> ([WorkTreeItem] -> CommandSeek)
|
||||||
-> [WorkTreeItem]
|
-> [WorkTreeItem]
|
||||||
-> CommandSeek
|
-> CommandSeek
|
||||||
withKeyOptions ko auto keyaction = withKeyOptions' ko auto mkkeyaction
|
withKeyOptions ko auto seeker keyaction = withKeyOptions' ko auto mkkeyaction
|
||||||
where
|
where
|
||||||
mkkeyaction = do
|
mkkeyaction = do
|
||||||
matcher <- Limit.getMatcher
|
matcher <- Limit.getMatcher
|
||||||
return $ \v@(k, ai) ->
|
return $ \v@(k, ai) -> checkseeker k $
|
||||||
let i = case ai of
|
let i = case ai of
|
||||||
ActionItemBranchFilePath (BranchFilePath _ topf) _ ->
|
ActionItemBranchFilePath (BranchFilePath _ topf) _ ->
|
||||||
MatchingKey k (AssociatedFile $ Just $ getTopFilePath topf)
|
MatchingKey k (AssociatedFile $ Just $ getTopFilePath topf)
|
||||||
_ -> MatchingKey k (AssociatedFile Nothing)
|
_ -> MatchingKey k (AssociatedFile Nothing)
|
||||||
in whenM (matcher i) $
|
in whenM (matcher i) $
|
||||||
keyaction v
|
keyaction v
|
||||||
|
checkseeker k a = case checkContentPresent seeker of
|
||||||
|
Nothing -> a
|
||||||
|
Just v -> do
|
||||||
|
present <- inAnnex k
|
||||||
|
when (present == v) a
|
||||||
|
|
||||||
withKeyOptions'
|
withKeyOptions'
|
||||||
:: Maybe KeyOptions
|
:: Maybe KeyOptions
|
||||||
|
|
|
@ -47,7 +47,7 @@ seek :: CopyOptions -> CommandSeek
|
||||||
seek o = startConcurrency commandStages $ do
|
seek o = startConcurrency commandStages $ do
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
NoBatch -> withKeyOptions
|
NoBatch -> withKeyOptions
|
||||||
(keyOptions o) (autoMode o)
|
(keyOptions o) (autoMode o) seeker
|
||||||
(commandAction . Command.Move.startKey (fromToOptions o) Command.Move.RemoveNever)
|
(commandAction . Command.Move.startKey (fromToOptions o) Command.Move.RemoveNever)
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (copyFiles o)
|
=<< workTreeItems ww (copyFiles o)
|
||||||
|
|
|
@ -55,7 +55,7 @@ seek :: DropOptions -> CommandSeek
|
||||||
seek o = startConcurrency commandStages $
|
seek o = startConcurrency commandStages $
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
Batch fmt -> batchAnnexedFilesMatching fmt seeker
|
Batch fmt -> batchAnnexedFilesMatching fmt seeker
|
||||||
NoBatch -> withKeyOptions (keyOptions o) (autoMode o)
|
NoBatch -> withKeyOptions (keyOptions o) (autoMode o) seeker
|
||||||
(commandAction . startKeys o)
|
(commandAction . startKeys o)
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (dropFiles o)
|
=<< workTreeItems ww (dropFiles o)
|
||||||
|
|
|
@ -65,7 +65,7 @@ seek o = do
|
||||||
, usesLocationLog = False
|
, usesLocationLog = False
|
||||||
}
|
}
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
NoBatch -> withKeyOptions (keyOptions o) False
|
NoBatch -> withKeyOptions (keyOptions o) False seeker
|
||||||
(commandAction . startKeys o)
|
(commandAction . startKeys o)
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (findThese o)
|
=<< workTreeItems ww (findThese o)
|
||||||
|
|
|
@ -97,7 +97,7 @@ seek o = startConcurrency commandStages $ do
|
||||||
, checkContentPresent = Nothing
|
, checkContentPresent = Nothing
|
||||||
, usesLocationLog = True
|
, usesLocationLog = True
|
||||||
}
|
}
|
||||||
withKeyOptions (keyOptions o) False
|
withKeyOptions (keyOptions o) False seeker
|
||||||
(\kai -> commandAction . startKey from i kai =<< getNumCopies)
|
(\kai -> commandAction . startKey from i kai =<< getNumCopies)
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (fsckFiles o)
|
=<< workTreeItems ww (fsckFiles o)
|
||||||
|
|
|
@ -46,7 +46,7 @@ seek o = startConcurrency downloadStages $ do
|
||||||
, usesLocationLog = True
|
, usesLocationLog = True
|
||||||
}
|
}
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
NoBatch -> withKeyOptions (keyOptions o) (autoMode o)
|
NoBatch -> withKeyOptions (keyOptions o) (autoMode o) seeker
|
||||||
(commandAction . startKeys from)
|
(commandAction . startKeys from)
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (getFiles o)
|
=<< workTreeItems ww (getFiles o)
|
||||||
|
@ -66,8 +66,7 @@ start o from file key = start' expensivecheck from key afile ai
|
||||||
|
|
||||||
startKeys :: Maybe Remote -> (Key, ActionItem) -> CommandStart
|
startKeys :: Maybe Remote -> (Key, ActionItem) -> CommandStart
|
||||||
startKeys from (key, ai) = checkFailedTransferDirection ai Download $
|
startKeys from (key, ai) = checkFailedTransferDirection ai Download $
|
||||||
stopUnless (not <$> inAnnex key) $
|
start' (return True) from key (AssociatedFile Nothing) ai
|
||||||
start' (return True) from key (AssociatedFile Nothing) ai
|
|
||||||
|
|
||||||
start' :: Annex Bool -> Maybe Remote -> Key -> AssociatedFile -> ActionItem -> CommandStart
|
start' :: Annex Bool -> Maybe Remote -> Key -> AssociatedFile -> ActionItem -> CommandStart
|
||||||
start' expensivecheck from key afile ai =
|
start' expensivecheck from key afile ai =
|
||||||
|
|
|
@ -86,7 +86,7 @@ seek o = case batchOption o of
|
||||||
GetAll -> withFilesInGitAnnex ww
|
GetAll -> withFilesInGitAnnex ww
|
||||||
Set _ -> withFilesInGitAnnexNonRecursive ww
|
Set _ -> withFilesInGitAnnexNonRecursive ww
|
||||||
"Not recursively setting metadata. Use --force to do that."
|
"Not recursively setting metadata. Use --force to do that."
|
||||||
withKeyOptions (keyOptions o) False
|
withKeyOptions (keyOptions o) False seeker
|
||||||
(commandAction . startKeys c o)
|
(commandAction . startKeys c o)
|
||||||
(seekaction seeker)
|
(seekaction seeker)
|
||||||
=<< workTreeItems ww (forFiles o)
|
=<< workTreeItems ww (forFiles o)
|
||||||
|
|
|
@ -42,7 +42,7 @@ instance DeferredParseClass MirrorOptions where
|
||||||
|
|
||||||
seek :: MirrorOptions -> CommandSeek
|
seek :: MirrorOptions -> CommandSeek
|
||||||
seek o = startConcurrency stages $
|
seek o = startConcurrency stages $
|
||||||
withKeyOptions (keyOptions o) False
|
withKeyOptions (keyOptions o) False seeker
|
||||||
(commandAction . startKey o (AssociatedFile Nothing))
|
(commandAction . startKey o (AssociatedFile Nothing))
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (mirrorFiles o)
|
=<< workTreeItems ww (mirrorFiles o)
|
||||||
|
|
|
@ -61,7 +61,7 @@ seek o = startConcurrency stages $ do
|
||||||
, usesLocationLog = False
|
, usesLocationLog = False
|
||||||
}
|
}
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
NoBatch -> withKeyOptions (keyOptions o) False
|
NoBatch -> withKeyOptions (keyOptions o) False seeker
|
||||||
(commandAction . startKey (fromToOptions o) (removeWhen o))
|
(commandAction . startKey (fromToOptions o) (removeWhen o))
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (moveFiles o)
|
=<< workTreeItems ww (moveFiles o)
|
||||||
|
|
|
@ -58,7 +58,7 @@ seek o = do
|
||||||
}
|
}
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
NoBatch -> do
|
NoBatch -> do
|
||||||
withKeyOptions (keyOptions o) False
|
withKeyOptions (keyOptions o) False seeker
|
||||||
(commandAction . startKeys o m)
|
(commandAction . startKeys o m)
|
||||||
(withFilesInGitAnnex ww seeker)
|
(withFilesInGitAnnex ww seeker)
|
||||||
=<< workTreeItems ww (whereisFiles o)
|
=<< workTreeItems ww (whereisFiles o)
|
||||||
|
|
Loading…
Reference in a new issue