Re: [PATCH] cherry-pick: Add an option to prepend a string to the commit message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

> --- 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...

[...]
> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]