added annex.commitmessage-command config
Sponsored-by: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
parent
66919bf6ec
commit
68e99513f0
5 changed files with 36 additions and 2 deletions
|
@ -500,11 +500,19 @@ append jl f appendable toappend = do
|
||||||
{- Commit message used when making a commit of whatever data has changed
|
{- Commit message used when making a commit of whatever data has changed
|
||||||
- to the git-annex branch. -}
|
- to the git-annex branch. -}
|
||||||
commitMessage :: Annex String
|
commitMessage :: Annex String
|
||||||
commitMessage = fromMaybe "update" . annexCommitMessage <$> Annex.getGitConfig
|
commitMessage = fromMaybe "update" <$> getCommitMessage
|
||||||
|
|
||||||
{- Commit message used when creating the branch. -}
|
{- Commit message used when creating the branch. -}
|
||||||
createMessage :: Annex String
|
createMessage :: Annex String
|
||||||
createMessage = fromMaybe "branch created" . annexCommitMessage <$> Annex.getGitConfig
|
createMessage = fromMaybe "branch created" <$> getCommitMessage
|
||||||
|
|
||||||
|
getCommitMessage :: Annex (Maybe String)
|
||||||
|
getCommitMessage = do
|
||||||
|
config <- Annex.getGitConfig
|
||||||
|
case annexCommitMessageCommand config of
|
||||||
|
Nothing -> return (annexCommitMessage config)
|
||||||
|
Just cmd -> catchDefaultIO (annexCommitMessage config) $
|
||||||
|
Just <$> liftIO (readProcess "sh" ["-c", cmd])
|
||||||
|
|
||||||
{- Stages the journal, and commits staged changes to the branch. -}
|
{- Stages the journal, and commits staged changes to the branch. -}
|
||||||
commit :: String -> Annex ()
|
commit :: String -> Annex ()
|
||||||
|
|
|
@ -11,6 +11,7 @@ git-annex (10.20240130) UNRELEASED; urgency=medium
|
||||||
* stack.yaml: Update to lts-22.9 and use crypton.
|
* stack.yaml: Update to lts-22.9 and use crypton.
|
||||||
* assistant, undo: When committing, let the usual git commit
|
* assistant, undo: When committing, let the usual git commit
|
||||||
hooks run.
|
hooks run.
|
||||||
|
* Added annex.commitmessage-command config.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 29 Jan 2024 15:59:33 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 29 Jan 2024 15:59:33 -0400
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ data GitConfig = GitConfig
|
||||||
, annexAlwaysCommit :: Bool
|
, annexAlwaysCommit :: Bool
|
||||||
, annexAlwaysCompact :: Bool
|
, annexAlwaysCompact :: Bool
|
||||||
, annexCommitMessage :: Maybe String
|
, annexCommitMessage :: Maybe String
|
||||||
|
, annexCommitMessageCommand :: Maybe String
|
||||||
, annexMergeAnnexBranches :: Bool
|
, annexMergeAnnexBranches :: Bool
|
||||||
, annexDelayAdd :: Maybe Int
|
, annexDelayAdd :: Maybe Int
|
||||||
, annexHttpHeaders :: [String]
|
, annexHttpHeaders :: [String]
|
||||||
|
@ -176,6 +177,7 @@ extractGitConfig configsource r = GitConfig
|
||||||
, annexAlwaysCommit = getbool (annexConfig "alwayscommit") True
|
, annexAlwaysCommit = getbool (annexConfig "alwayscommit") True
|
||||||
, annexAlwaysCompact = getbool (annexConfig "alwayscompact") True
|
, annexAlwaysCompact = getbool (annexConfig "alwayscompact") True
|
||||||
, annexCommitMessage = getmaybe (annexConfig "commitmessage")
|
, annexCommitMessage = getmaybe (annexConfig "commitmessage")
|
||||||
|
, annexCommitMessageCommand = getmaybe (annexConfig "commitmessage-command")
|
||||||
, annexMergeAnnexBranches = getbool (annexConfig "merge-annex-branches") True
|
, annexMergeAnnexBranches = getbool (annexConfig "merge-annex-branches") True
|
||||||
, annexDelayAdd = getmayberead (annexConfig "delayadd")
|
, annexDelayAdd = getmayberead (annexConfig "delayadd")
|
||||||
, annexHttpHeaders = getlist (annexConfig "http-headers")
|
, annexHttpHeaders = getlist (annexConfig "http-headers")
|
||||||
|
|
|
@ -1088,6 +1088,11 @@ repository, using [[git-annex-config]]. See its man page for a list.)
|
||||||
This works well in combination with annex.alwayscommit=false,
|
This works well in combination with annex.alwayscommit=false,
|
||||||
to gather up a set of changes and commit them with a message you specify.
|
to gather up a set of changes and commit them with a message you specify.
|
||||||
|
|
||||||
|
* `annex.commitmessage-command`
|
||||||
|
|
||||||
|
This command is run and its output is used as the commit message to the
|
||||||
|
git-annex branch.
|
||||||
|
|
||||||
* `annex.alwayscompact`
|
* `annex.alwayscompact`
|
||||||
|
|
||||||
By default, git-annex compacts data it records in the git-annex branch.
|
By default, git-annex compacts data it records in the git-annex branch.
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 6"""
|
||||||
|
date="2024-02-12T17:36:32Z"
|
||||||
|
content="""
|
||||||
|
Turns out that the assistant doesn't commit to the git-annex branch itself,
|
||||||
|
instead the pre-commit hook runs `git-annex pre-commit`, and
|
||||||
|
the git-annex branch commit on process shutdown is where the commit
|
||||||
|
happens.
|
||||||
|
|
||||||
|
A bit surprising! If the pre-commit hook didn't run git-annex,
|
||||||
|
the assistant would later explicitly commit the branch before
|
||||||
|
pushing to remotes.
|
||||||
|
|
||||||
|
Anyway, this does mean you can rely on the git-annex branch commit
|
||||||
|
happening after the working tree commit. At least, when there are
|
||||||
|
no other git-annex processes running.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue