assistant prompt pushing of manual commits to remotes

assistant: When annex.autocommit is set, notice commits that the user makes
manually, and push them out to remotes promptly.

Sponsored-by: Boyd Stephen Smith Jr. on Patreon
This commit is contained in:
Joey Hess 2022-03-31 13:02:16 -04:00
parent 9c6dc9db0c
commit ff6b36c706
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 25 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{- git-annex assistant git merge thread
-
- Copyright 2012-2017 Joey Hess <id@joeyh.name>
- Copyright 2012-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -17,6 +17,7 @@ import Utility.DirWatcher
import Utility.DirWatcher.Types
import Utility.Directory.Create
import Annex.CurrentBranch
import Assistant.Commits
import qualified Annex
import qualified Annex.Branch
import qualified Git
@ -83,7 +84,7 @@ onChange file
mergecurrent =
mergecurrent' =<< liftAnnex getCurrentBranch
mergecurrent' currbranch@(Just b, _)
| changedbranch `isRelatedTo` b =
| changedbranch `isRelatedTo` b = do
whenM (liftAnnex $ inRepo $ Git.Branch.changed b changedbranch) $ do
debug
[ "merging", Git.fromRef changedbranch
@ -99,6 +100,12 @@ onChange file
def
cmode
changedbranch
recordCommit
| changedbranch == b =
-- Record commit so the pusher pushes it out.
-- This makes sure pushes happen when
-- annex.autocommit=false
recordCommit
mergecurrent' _ = noop
{- Is the first branch a synced branch or remote tracking branch related

View file

@ -4,6 +4,8 @@ git-annex (10.20220323) UNRELEASED; urgency=medium
or by git-annex numcopies or by --numcopies, since that
configuration would make git-annex easily lose data.
Same for mincopies.
* assistant: When annex.autocommit is set, notice commits that
the user makes manually, and push them out to remotes promptly.
-- Joey Hess <id@joeyh.name> Mon, 28 Mar 2022 14:46:10 -0400

View file

@ -0,0 +1,14 @@
[[!comment format=mdwn
username="joey"
subject="""comment 7"""
date="2022-03-31T16:59:13Z"
content="""
@Atemu would have been a good idea to file a bug about that.
I think the assistant would probably eventually get around to pushing a
commit that you made with annex.autocommit=false, but it did not promptly
notice such commits and push them.
I've made a small change that does make it promptly push commits that
were made to the current branch.
"""]]