assistant prompt pushing of manual commits to remotes
authorJoey Hess <joeyh@joeyh.name>
Thu, 31 Mar 2022 17:02:16 +0000 (13:02 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 31 Mar 2022 17:02:16 +0000 (13:02 -0400)
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
Assistant/Threads/Merger.hs
CHANGELOG
doc/forum/Use_assistant_to_sync_just_git_repos__63__/comment_7_4ba1e89d84fedfd6508f37717310893d._comment [new file with mode: 0644]

index cc2a90d07a01bef85d6a4d3a5626d9839a866ba3..23c9700df0801b18d2736d8d3d3db170f54d9d87 100644 (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
index f7972935bd04f0b1367649f2148a53678a5aac73..abc1b32ec8d4dfad0d07a321d5e614b1bf0995c8 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
 
diff --git a/doc/forum/Use_assistant_to_sync_just_git_repos__63__/comment_7_4ba1e89d84fedfd6508f37717310893d._comment b/doc/forum/Use_assistant_to_sync_just_git_repos__63__/comment_7_4ba1e89d84fedfd6508f37717310893d._comment
new file mode 100644 (file)
index 0000000..2bb5a8e
--- /dev/null
@@ -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.
+"""]]