From: Joey Hess Date: Fri, 29 Aug 2025 16:45:33 +0000 (-0400) Subject: drop: --fast support when dropping from a remote X-Git-Tag: archive/raspbian/10.20251029-1+rpi1~1^2~3^2~167 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=146d224c6342b7d8f9c6499db01c125f83c25593;p=git-annex.git drop: --fast support when dropping from a remote This is the same as --not --in $remote, but easier to type. And the documentation of --fast helps also document that drop can do extra work when used without --fast. Sponsored-by: Nicholas Golder-Manning --- diff --git a/CHANGELOG b/CHANGELOG index 34d9e65c91..dfd780321a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +git-annex (10.20250829) UNRELEASED; urgency=medium + + * drop: --fast support when dropping from a remote. + + -- Joey Hess Fri, 29 Aug 2025 12:34:06 -0400 + git-annex (10.20250828) upstream; urgency=medium * p2p: Added --enable option, which can be used to enable P2P networks diff --git a/Command/Drop.hs b/Command/Drop.hs index 94720a6ae4..2f27da92dc 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2010-2021 Joey Hess + - Copyright 2010-2025 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -109,8 +109,17 @@ startLocal lu pcc afile ai si numcopies mincopies key preverified ud = performLocal lu pcc key afile numcopies mincopies preverified ud startRemote :: LiveUpdate -> PreferredContentChecked -> AssociatedFile -> ActionItem -> SeekInput -> NumCopies -> MinCopies -> Key -> DroppingUnused -> Remote -> CommandStart -startRemote lu pcc afile ai si numcopies mincopies key ud remote = - starting "drop" (OnlyActionOn key ai) si $ do +startRemote lu pcc afile ai si numcopies mincopies key ud remote = do + fast <- Annex.getRead Annex.fast + if fast + then do + remotes <- Remote.keyPossibilities (Remote.IncludeIgnored True) key + if remote `elem` remotes + then go + else stop + else go + where + go = starting "drop" (OnlyActionOn key ai) si $ do showAction $ UnquotedString $ "from " ++ Remote.name remote performRemote lu pcc key afile numcopies mincopies remote ud diff --git a/doc/git-annex-drop.mdwn b/doc/git-annex-drop.mdwn index aa66696958..3d1307700a 100644 --- a/doc/git-annex-drop.mdwn +++ b/doc/git-annex-drop.mdwn @@ -42,6 +42,13 @@ Paths of files or directories to drop can be specified. this option can specify a remote from which the files' contents should be removed. +* `--fast` + + When dropping from a remote, avoid doing anything when the remote is not + believed to contain a file. Usually each file is attempted to be dropped + from the remote. This can be faster, but might leave some files on the + remote in some cases. + * `--auto` Rather than trying to drop all specified files, drop only those that diff --git a/doc/todo/drop_--from_unnecessary_locking_of_files_not_in_remote.mdwn b/doc/todo/drop_--from_unnecessary_locking_of_files_not_in_remote.mdwn index ac4b455a75..cedb23572c 100644 --- a/doc/todo/drop_--from_unnecessary_locking_of_files_not_in_remote.mdwn +++ b/doc/todo/drop_--from_unnecessary_locking_of_files_not_in_remote.mdwn @@ -8,11 +8,15 @@ Using `git-annex drop --from foo --in foo` avoided the problem. The reason drop behaves this way is that it's intended to remove content from a remote even when the local repository's location log -is out of sync with it. Still, it's somewhat surprising and annoying that -it can need to do so much extra work. +is out of sync with it. In order to avoid the surprising behavior of +`git-annex drop foo` saying it succeeded, in a case where it turns out the +remote just recently got the file. Still, it's somewhat surprising too, and +annoying, that it can need to do so much extra work. Note that checking if the remote actually has the content would be about as slow as locking files on the other remote(s) (assuming a small numcopies). `--fast` could be made to deal with this, making it check the location log. --[[Joey]] + +> [[done]]