From c8bd5710b1afbf25aefdda7cc75abf7dc20de943 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Nov 2018 15:43:51 -0400 Subject: [PATCH] check onlyActionOn in Drop * drop -J: Avoid processing the same key twice at the same time when multiple annexes files use it. This prevents a drop of a key conflicting with another drop of the same key. This commit was sponsored by Brock Spratlen on Patreon. --- CHANGELOG | 2 ++ Command/Drop.hs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 3a50cd4495..2a27d3704c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,8 @@ git-annex (7.20181106) UNRELEASED; urgency=medium to an exporttree remote that already contains the files. * smudge: When passed a file located outside the working tree, eg by git diff, avoid erroring out. + * drop -J: Avoid processing the same key twice at the same time when + multiple annexes files use it. -- Joey Hess Tue, 06 Nov 2018 12:44:27 -0400 diff --git a/Command/Drop.hs b/Command/Drop.hs index 6de808de9c..c48fe353cb 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -68,7 +68,7 @@ start o file key = start' o key afile (mkActionItem afile) afile = AssociatedFile (Just file) start' :: DropOptions -> Key -> AssociatedFile -> ActionItem -> CommandStart -start' o key afile ai = do +start' o key afile ai = onlyActionOn key $ do from <- maybe (pure Nothing) (Just <$$> getParsed) (dropFrom o) checkDropAuto (autoMode o) from afile key $ \numcopies -> stopUnless (want from) $