From 8b6dad11a21510f3f372e5780d2c3c561422c4e2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 May 2021 13:07:47 -0400 Subject: [PATCH] add createMessage init: When annex.commitmessage is set, use that message for the commit that creates the git-annex branch. This will be used by filter-branch too, and it seems to make sense to let annex.commitmessage affect it. --- Annex/Branch.hs | 8 +++++++- CHANGELOG | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 7b3fa0def9..28208d266e 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -24,6 +24,7 @@ module Annex.Branch ( change, maybeChange, commitMessage, + createMessage, commit, forceCommit, getBranch, @@ -129,7 +130,8 @@ getBranch = maybe (hasOrigin >>= go >>= use) return =<< branchsha <$> branchsha go False = withIndex' True $ do cmode <- annexCommitMode <$> Annex.getGitConfig - inRepo $ Git.Branch.commitAlways cmode "branch created" fullname [] + cmessage <- createMessage + inRepo $ Git.Branch.commitAlways cmode cmessage fullname [] use sha = do setIndexSha sha return sha @@ -363,6 +365,10 @@ set jl ru f c = do commitMessage :: Annex String commitMessage = fromMaybe "update" . annexCommitMessage <$> Annex.getGitConfig +{- Commit message used when creating the branch. -} +createMessage :: Annex String +createMessage = fromMaybe "branch created" . annexCommitMessage <$> Annex.getGitConfig + {- Stages the journal, and commits staged changes to the branch. -} commit :: String -> Annex () commit = whenM (journalDirty gitAnnexJournalDir) . forceCommit diff --git a/CHANGELOG b/CHANGELOG index bb71154ab7..46e6723268 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,8 @@ git-annex (8.20210429) UNRELEASED; urgency=medium * reinject: Error out when run on a file that is not annexed, rather than silently skipping it. * assistant: Fix a crash on startup by avoiding using forkProcess. + * init: When annex.commitmessage is set, use that message for the commit + that creates the git-annex branch. -- Joey Hess Mon, 03 May 2021 10:33:10 -0400