From ff6b36c706efe1a63f121e57e45776f5f6628163 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 31 Mar 2022 13:02:16 -0400 Subject: [PATCH] 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 --- Assistant/Threads/Merger.hs | 11 +++++++++-- CHANGELOG | 2 ++ ...ent_7_4ba1e89d84fedfd6508f37717310893d._comment | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 doc/forum/Use_assistant_to_sync_just_git_repos__63__/comment_7_4ba1e89d84fedfd6508f37717310893d._comment diff --git a/Assistant/Threads/Merger.hs b/Assistant/Threads/Merger.hs index cc2a90d07a..23c9700df0 100644 --- a/Assistant/Threads/Merger.hs +++ b/Assistant/Threads/Merger.hs @@ -1,6 +1,6 @@ {- git-annex assistant git merge thread - - - Copyright 2012-2017 Joey Hess + - Copyright 2012-2021 Joey Hess - - 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 diff --git a/CHANGELOG b/CHANGELOG index f7972935bd..abc1b32ec8 100644 --- 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 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 index 0000000000..2bb5a8eb43 --- /dev/null +++ b/doc/forum/Use_assistant_to_sync_just_git_repos__63__/comment_7_4ba1e89d84fedfd6508f37717310893d._comment @@ -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. +"""]]