(commitCommitterMetaData basiscommit)
(mkcommit cmode)
mkcommit cmode = Git.Branch.commitTree cmode
- [adjustedBranchCommitMessage] parents treesha
+ adjustedBranchCommitMessage parents treesha
{- This message should never be changed. -}
adjustedBranchCommitMessage :: String
(commitAuthorMetaData basiscommit)
(commitCommitterMetaData basiscommit) $
Git.Branch.commitTree cmode
- [commitMessage basiscommit]
+ (commitMessage basiscommit)
[commitparent] treesha
return (Right revadjcommit)
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
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
{ importCommitTracking :: Maybe Sha
-- ^ Current commit on the remote tracking branch.
, importCommitMode :: Git.Branch.CommitMode
- , importCommitMessages :: [String]
+ , importCommitMessage :: String
}
{- Buils a commit for an import from a special remote.
mkcommit parents tree = inRepo $ Git.Branch.commitTree
(importCommitMode importcommitconfig)
- (importCommitMessages importcommitconfig)
+ (importCommitMessage importcommitconfig)
parents
tree
cmode <- annexCommitMode <$> Annex.getGitConfig
inRepo $ Git.Branch.commitTree
cmode
- ["remote tracking branch"]
+ "remote tracking branch"
[commitsha, importedhistory]
treesha
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
the same repository.
* Windows: Fix escaping output to terminal when using old
versions of MinTTY.
- * sync, assist, import: Allow -m option to be specified multiple
- times, to provide additional paragraphs for the commit message.
-- Joey Hess <id@joeyh.name> Tue, 27 Feb 2024 13:07:10 -0400
liftIO $ removeWhenExistsWith removeLink tmpindex
cmode <- annexCommitMode <$> Annex.getGitConfig
cmessage <- Annex.Branch.commitMessage
- c <- inRepo $ Git.commitTree cmode [cmessage] [] t
+ c <- inRepo $ Git.commitTree cmode cmessage [] t
liftIO $ putStrLn (fromRef c)
where
ww = WarnUnmatchLsFiles "filter-branch"
{- git-annex command
-
- - Copyright 2012-2024 Joey Hess <id@joeyh.name>
+ - Copyright 2012-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
, importToSubDir :: Maybe FilePath
, importContent :: Bool
, checkGitIgnoreOption :: CheckGitIgnore
- , messageOption :: [String]
+ , messageOption :: Maybe String
}
optParser :: CmdParamsDesc -> Parser ImportOptions
)
dupmode <- fromMaybe Default <$> optional duplicateModeParser
ic <- Command.Add.checkGitIgnoreSwitch
- message <- many (strOption
+ message <- optional (strOption
( long "message" <> short 'm' <> metavar "MSG"
<> help "commit message"
))
verifyEnoughCopiesToDrop [] key Nothing needcopies mincopies [] preverified tocheck
(const yes) no
-seekRemote :: Remote -> Branch -> Maybe TopFilePath -> Bool -> CheckGitIgnore -> [String] -> CommandSeek
-seekRemote remote branch msubdir importcontent ci importmessages = do
+seekRemote :: Remote -> Branch -> Maybe TopFilePath -> Bool -> CheckGitIgnore -> Maybe String -> CommandSeek
+seekRemote remote branch msubdir importcontent ci mimportmessage = do
importtreeconfig <- case msubdir of
Nothing -> return ImportTree
Just subdir ->
trackingcommit <- fromtrackingbranch Git.Ref.sha
cmode <- annexCommitMode <$> Annex.getGitConfig
- let importcommitconfig = ImportCommitConfig trackingcommit cmode importmessages'
+ let importcommitconfig = ImportCommitConfig trackingcommit cmode importmessage
let commitimport = commitRemote remote branch tb trackingcommit importtreeconfig importcommitconfig
importabletvar <- liftIO $ newTVarIO Nothing
includeCommandAction $
commitimport imported
where
- importmessages'
- | null importmessages = ["import from " ++ Remote.name remote]
- | otherwise = importmessages
+ importmessage = fromMaybe
+ ("import from " ++ Remote.name remote)
+ mimportmessage
tb = mkRemoteTrackingBranch remote branch
{- git-annex command
-
- Copyright 2011 Joachim Breitner <mail@joachim-breitner.de>
- - Copyright 2011-2024 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2023 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
, notOnlyAnnexOption :: Bool
, commitOption :: Bool
, noCommitOption :: Bool
- , messageOption :: [String]
+ , messageOption :: Maybe String
, pullOption :: Bool
, pushOption :: Bool
, contentOption :: Maybe Bool
, notOnlyAnnexOption = False
, commitOption = False
, noCommitOption = False
- , messageOption = []
+ , messageOption = Nothing
, pullOption = False
, pushOption = False
, contentOption = Just False
( long "no-commit"
<> help "avoid git commit"
))
- <*> unlessmode [SyncMode, AssistMode] []
- (many (strOption
+ <*> unlessmode [SyncMode, AssistMode] Nothing
+ (optional (strOption
( long "message" <> short 'm' <> metavar "MSG"
<> help "commit message"
)))
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" ] ++ mopts)
+ void $ inRepo $ Git.Branch.commitCommand cmode cquiet
+ [ Param "-a"
+ , Param "-m"
+ , Param commitmessage
+ ]
return True
where
shouldcommit = notOnlyAnnex o <&&>
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) $
let (branch, subdir) = splitRemoteAnnexTrackingBranchSubdir b
if canImportKeys remote importcontent
then do
- Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) []
+ Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) Nothing
-- Importing generates a branch
-- that is not initially connected
-- to the current branch, so allow
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
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
Use this option to specify a commit message.
- If multiple -m options are given, their values are concatenated
- as separate paragraphs.
-
* `--content-of=path` `-C path`
Only add, pull, and push files in the given path.
Use this option to specify a commit message for the changes that have
been made to the special remote since the last import from it.
- If multiple -m options are given, their values are concatenated
- as separate paragraphs.
-
# IMPORTING FROM A DIRECTORY
When run with a path, `git annex import` **moves** files from somewhere outside
Use this option to specify a commit message.
- If multiple -m options are given, their values are concatenated
- as separate paragraphs.
-
* `--pull`, `--no-pull`
Use this option to disable pulling.
git-annex sync etc -m should be able to be specified multiple times. In git
commit, multiple -m can be used to make a multiparagraph commit. --[[Joey]]
-
-> [[done]]