From: Joey Hess Date: Mon, 23 Jan 2023 21:53:57 +0000 (-0400) Subject: fix behavior of copy --from --to X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~60^2~13^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=77266e46dda7009e7d62c6ae18ac22c535438472;p=git-annex.git fix behavior of copy --from --to Sponsored-by: Dartmouth College's DANDI project --- diff --git a/Command/Move.hs b/Command/Move.hs index b105306bf2..0f66948379 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -432,9 +432,10 @@ fromToPerform src dest removewhen key afile = do todest mcontentlock removewhen' = toPerform' mcontentlock dest removewhen' key afile False - dropfromsrc adjusttocheck = - logMove (Remote.uuid src) (Remote.uuid dest) True key $ \deststartedwithcopy -> + dropfromsrc adjusttocheck = case removewhen of + RemoveSafe -> logMove (Remote.uuid src) (Remote.uuid dest) True key $ \deststartedwithcopy -> fromDrop src (Remote.uuid dest) deststartedwithcopy key afile adjusttocheck + RemoveNever -> next (return True) combinecleanups a b = a >>= \case Just cleanupa -> b True >>= \case diff --git a/doc/git-annex-copy.mdwn b/doc/git-annex-copy.mdwn index 03563bda11..acf3b2a32d 100644 --- a/doc/git-annex-copy.mdwn +++ b/doc/git-annex-copy.mdwn @@ -34,10 +34,12 @@ Paths of files or directories to operate on can be specified. * `--from=remote1 --to=remote2` - Copy the content of files that are in remote1 to remote2. Does not change - what is stored in the local repository. + Copy the content of files that are in remote1 to remote2. - Note: This may need to store an intermediate copy of the content on disk. + This is implemented by first downloading the content from remote1 to the + local repository (if not already present), then sending it to remote2, and + then deleting the content from the local repository (if it was not present + to start with). * `--jobs=N` `-JN`