Re: [PATCH] cherry-pick: Add an option to prepend a string to the commit message
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jun 12, 2010, 05:58 UTC
- Message-ID
- <20100612055831.GA2426@burratino>
- In-Reply-To
- <1276319237-12010-1-git-send-email-bobbypowers@gmail.com>
Bobby Powers wrote:
> This can be useful situations where you have a batch of commits to > cherry-pick and need to prefix each new commit message with similar > information
Sounds reasonable.
Cc-ing Christian who is closer to an area expert.
> (such as the subversion revision, when used in conjunction > with git-svn).
Could you give an example? I am imagining
git cherry-pick --prepend='r3815: ' HEAD..svn/Trunk
but I haven’t figured out the context.
The patch itself is clean. Two tiny nitpicks:
Show 11 quoted lines
> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -64,7 +65,7 @@ static void parse_args(int argc, const char **argv)
> OPT_INTEGER('m', "mainline", &mainline, "parent number"),
> OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
> OPT_STRING(0, "strategy", &strategy, "strategy", "merge strategy"),
> - OPT_END(),
> + OPT_STRING(0, "prepend", &prepend, "message", "string to prepend to the commit message"),
> OPT_END(),
> OPT_END(),
> };This adds an option to cherry-pick and revert...
[...]
Show 10 quoted lines
> @@ -482,6 +485,9 @@ static int revert_or_cherry_pick(int argc, const char **argv)
> next = commit;
> next_label = msg.label;
> set_author_ident_env(msg.message);
> + if (prepend) {
> + strbuf_addstr(&msgbuf, prepend);
> + }
> add_message_to_msg(&msgbuf, msg.message);
> if (no_replay) {
> strbuf_addstr(&msgbuf, "(cherry picked from commit ");... and implements it only for cherry-pick (with unnecessary braces).
I would be interested to hear from those who might know whether something generic like the applypatch-msg hook could work (which is not to say a convenient command-line option would not be handy to have in addition to that.)
Jonathan