multiple -m

sync, assist, import: Allow -m option to be specified multiple times, to
provide additional paragraphs for the commit message.

The option parser didn't allow multiple -m before, so there is no risk of
behavior change breaking something that was for some reason using multiple
-m already.

Pass through to git commands, so that the method used to assemble the
paragrahs is whatever git does. Which might conceivably change in the
future.

Note that git commit-tree has supported -m since git 1.7.7. commitTree
was probably not using it since it predates that version. Since the
configure script prevents building git-annex with git older than 2.1,
there is no risk that it's not supported now.

Sponsored-by: Nicholas Golder-Manning on Patreon
This commit is contained in:
Joey Hess 2024-03-27 15:58:27 -04:00
parent 377e9fff18
commit cee12f6a2f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
15 changed files with 57 additions and 41 deletions

View file

@ -469,7 +469,7 @@ commitAdjustedTree' treesha (BasisBranch basis) parents =
(commitCommitterMetaData basiscommit)
(mkcommit cmode)
mkcommit cmode = Git.Branch.commitTree cmode
adjustedBranchCommitMessage parents treesha
[adjustedBranchCommitMessage] parents treesha
{- This message should never be changed. -}
adjustedBranchCommitMessage :: String
@ -577,7 +577,7 @@ reverseAdjustedCommit commitparent adj (csha, basiscommit) origbranch
(commitAuthorMetaData basiscommit)
(commitCommitterMetaData basiscommit) $
Git.Branch.commitTree cmode
(commitMessage basiscommit)
[commitMessage basiscommit]
[commitparent] treesha
return (Right revadjcommit)

View file

@ -153,7 +153,8 @@ mergeToAdjustedBranch tomerge (origbranch, adj) mergeconfig canresolvemerge comm
then do
cmode <- annexCommitMode <$> Annex.getGitConfig
c <- inRepo $ Git.Branch.commitTree cmode
("Merged " ++ fromRef tomerge) [adjmergecommit]
["Merged " ++ fromRef tomerge]
[adjmergecommit]
(commitTree currentcommit)
inRepo $ Git.Branch.update "updating adjusted branch" currbranch c
propigateAdjustedCommits origbranch adj

View file

@ -945,9 +945,9 @@ rememberTreeishLocked treeish graftpoint jl = do
addedt <- inRepo $ Git.Tree.graftTree treeish graftpoint origtree
cmode <- annexCommitMode <$> Annex.getGitConfig
c <- inRepo $ Git.Branch.commitTree cmode
"graft" [branchref] addedt
["graft"] [branchref] addedt
c' <- inRepo $ Git.Branch.commitTree cmode
"graft cleanup" [c] origtree
["graft cleanup"] [c] origtree
inRepo $ Git.Branch.update' fullname c'
-- The tree in c' is the same as the tree in branchref,
-- and the index was updated to that above, so it's safe to

View file

@ -86,7 +86,7 @@ data ImportCommitConfig = ImportCommitConfig
{ importCommitTracking :: Maybe Sha
-- ^ Current commit on the remote tracking branch.
, importCommitMode :: Git.Branch.CommitMode
, importCommitMessage :: String
, importCommitMessages :: [String]
}
{- Buils a commit for an import from a special remote.
@ -251,7 +251,7 @@ buildImportCommit' remote importcommitconfig mtrackingcommit imported@(History t
mkcommit parents tree = inRepo $ Git.Branch.commitTree
(importCommitMode importcommitconfig)
(importCommitMessage importcommitconfig)
(importCommitMessages importcommitconfig)
parents
tree

View file

@ -77,7 +77,7 @@ makeRemoteTrackingBranchMergeCommit' commitsha importedhistory treesha = do
cmode <- annexCommitMode <$> Annex.getGitConfig
inRepo $ Git.Branch.commitTree
cmode
"remote tracking branch"
["remote tracking branch"]
[commitsha, importedhistory]
treesha

View file

@ -577,7 +577,7 @@ updateView view madj = do
cmode <- annexCommitMode <$> Annex.getGitConfig
let msg = "updated " ++ fromRef (branchView view madj)
let parent = catMaybes [oldcommit]
inRepo (Git.Branch.commitTree cmode msg parent newtree)
inRepo (Git.Branch.commitTree cmode [msg] parent newtree)
else return Nothing
{- Diff between currently checked out branch and staged changes, and