Honor --force option when operating on a local git remote
authorJoey Hess <joeyh@joeyh.name>
Wed, 19 Apr 2023 16:53:58 +0000 (12:53 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 19 Apr 2023 16:53:58 +0000 (12:53 -0400)
Propagate Annex.force into the remote's Annex state.

Fixes this problem:

joey@darkstar:~/tmp/xxxx>git-annex copy mmm --to origin --force
copy mmm (to origin...)
  not enough free space, need 908.72 MB more (use --force to override this check or adjust annex.diskreserve)

  failed to send content to remote
failed

Does beg the question if anything else should be propagated.
Some things like Annex.forcenumcopies certianly not; using --numcopies
overrides the number of copies the current repo wants, not all of them.

Sponsored-by: Graham Spencer on Patreon
CHANGELOG
Remote/Git.hs

index 4efdca332f7db02c21903337044202f328ac1967..1dd4b21053c40ee4ece08e27b6622532d42745c3 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -24,6 +24,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
     setting of a special remote.
   * assistant --autostop: Avoid crashing when ~/.config/git-annex/autostart
     lists a directory that it cannot chdir to.
+  * Honor --force option when operating on a local git remote.
 
  -- Joey Hess <id@joeyh.name>  Sat, 08 Apr 2023 13:57:18 -0400
 
index 14bb097c17185f583edce8a30dd7f7d1da88de98..387fb9d4f0a15d21d097fddf6b161c6ba1721b9c 100644 (file)
@@ -637,9 +637,11 @@ newLocal repo = do
        (st, rd) <- liftIO $ Annex.new repo
        debugenabled <- Annex.getRead Annex.debugenabled
        debugselector <- Annex.getRead Annex.debugselector
+       force <- Annex.getRead Annex.force
        return (st,  rd
                { Annex.debugenabled = debugenabled
                , Annex.debugselector = debugselector
+               , Annex.force = force
                })
 
 onLocal' :: LocalRemoteAnnex -> Annex a -> Annex a