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:
parent
377e9fff18
commit
cee12f6a2f
15 changed files with 57 additions and 41 deletions
|
@ -1,7 +1,7 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2011 Joachim Breitner <mail@joachim-breitner.de>
|
||||
- Copyright 2011-2023 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2011-2024 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -105,7 +105,7 @@ data SyncOptions = SyncOptions
|
|||
, notOnlyAnnexOption :: Bool
|
||||
, commitOption :: Bool
|
||||
, noCommitOption :: Bool
|
||||
, messageOption :: Maybe String
|
||||
, messageOption :: [String]
|
||||
, pullOption :: Bool
|
||||
, pushOption :: Bool
|
||||
, contentOption :: Maybe Bool
|
||||
|
@ -125,7 +125,7 @@ instance Default SyncOptions where
|
|||
, notOnlyAnnexOption = False
|
||||
, commitOption = False
|
||||
, noCommitOption = False
|
||||
, messageOption = Nothing
|
||||
, messageOption = []
|
||||
, pullOption = False
|
||||
, pushOption = False
|
||||
, contentOption = Just False
|
||||
|
@ -169,8 +169,8 @@ optParser mode desc = SyncOptions
|
|||
( long "no-commit"
|
||||
<> help "avoid git commit"
|
||||
))
|
||||
<*> unlessmode [SyncMode, AssistMode] Nothing
|
||||
(optional (strOption
|
||||
<*> unlessmode [SyncMode, AssistMode] []
|
||||
(many (strOption
|
||||
( long "message" <> short 'm' <> metavar "MSG"
|
||||
<> help "commit message"
|
||||
)))
|
||||
|
@ -402,17 +402,18 @@ syncRemotes' ps available =
|
|||
|
||||
commit :: SyncOptions -> CommandStart
|
||||
commit o = stopUnless shouldcommit $ starting "commit" ai si $ do
|
||||
commitmessage <- maybe commitMsg return (messageOption o)
|
||||
Annex.Branch.commit =<< Annex.Branch.commitMessage
|
||||
mopts <- concatMap (\msg -> [Param "-m", Param msg])
|
||||
<$> if null (messageOption o)
|
||||
then (:[]) <$> commitMsg
|
||||
else pure (messageOption o)
|
||||
next $ do
|
||||
showOutput
|
||||
let cmode = Git.Branch.ManualCommit
|
||||
cquiet <- Git.Branch.CommitQuiet <$> commandProgressDisabled
|
||||
void $ inRepo $ Git.Branch.commitCommand cmode cquiet
|
||||
[ Param "-a"
|
||||
, Param "-m"
|
||||
, Param commitmessage
|
||||
]
|
||||
void $ inRepo $ Git.Branch.commitCommand
|
||||
cmode cquiet
|
||||
([ Param "-a" ] ++ mopts)
|
||||
return True
|
||||
where
|
||||
shouldcommit = notOnlyAnnex o <&&>
|
||||
|
@ -426,7 +427,8 @@ commitMsg :: Annex String
|
|||
commitMsg = do
|
||||
u <- getUUID
|
||||
m <- uuidDescMap
|
||||
return $ "git-annex in " ++ maybe "unknown" fromUUIDDesc (M.lookup u m)
|
||||
return $ "git-annex in "
|
||||
++ maybe "unknown" fromUUIDDesc (M.lookup u m)
|
||||
|
||||
mergeLocal :: [Git.Merge.MergeConfig] -> SyncOptions -> CurrBranch -> CommandStart
|
||||
mergeLocal mergeconfig o currbranch = stopUnless (notOnlyAnnex o) $
|
||||
|
@ -578,7 +580,7 @@ importRemote importcontent o remote currbranch
|
|||
let (branch, subdir) = splitRemoteAnnexTrackingBranchSubdir b
|
||||
if canImportKeys remote importcontent
|
||||
then do
|
||||
Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) Nothing
|
||||
Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) []
|
||||
-- Importing generates a branch
|
||||
-- that is not initially connected
|
||||
-- to the current branch, so allow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue