Revert "multiple -m"

This reverts commit cee12f6a2f.

This commit broke git-annex init run in a repo that was cloned from a
repo with an adjusted branch checked out.

The problem is that findAdjustingCommit was not able to identify the
commit that created the adjusted branch. It seems that there is an extra
"\n" at the end of the commit message that it does not expect.

Since backwards compatability needs to be maintained, cannot just make
findAdjustingCommit accept it with the "\n". Will have to instead
have one commitTree variant that uses the old method, and use it for
adjusted branch committing.
This commit is contained in:
Joey Hess 2024-04-02 17:29:07 -04:00
parent 2b0df3a76d
commit a8dd85ea5a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
15 changed files with 41 additions and 57 deletions

View file

@ -178,7 +178,7 @@ commit commitmode allowempty message branch parentrefs repo = do
tree <- writeTree repo
ifM (cancommit tree)
( do
sha <- commitTree commitmode [message] parentrefs tree repo
sha <- commitTree commitmode message parentrefs tree repo
update' branch sha repo
return $ Just sha
, return Nothing
@ -207,15 +207,15 @@ writeTreeQuiet repo = extractSha <$> withNullHandle go
go nullh = pipeReadStrict' (\p -> p { std_err = UseHandle nullh })
[Param "write-tree"] repo
commitTree :: CommitMode -> [String] -> [Ref] -> Ref -> Repo -> IO Sha
commitTree commitmode messages parentrefs tree repo =
getSha "commit-tree" $ pipeReadStrict ps repo
commitTree :: CommitMode -> String -> [Ref] -> Ref -> Repo -> IO Sha
commitTree commitmode message parentrefs tree repo =
getSha "commit-tree" $
pipeWriteRead ([Param "commit-tree", Param (fromRef tree)] ++ ps)
sendmsg repo
where
ps = [Param "commit-tree", Param (fromRef tree)]
++ applyCommitModeForCommitTree commitmode baseparams repo
baseparams = map Param $
concatMap (\r -> ["-p", fromRef r]) parentrefs
++ concatMap (\msg -> ["-m", msg]) messages
sendmsg = Just $ flip hPutStr message
ps = applyCommitModeForCommitTree commitmode parentparams repo
parentparams = map Param $ concatMap (\r -> ["-p", fromRef r]) parentrefs
{- A leading + makes git-push force pushing a branch. -}
forcePush :: String -> String