git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Bobby Powers <bobbypowers@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH] cherry-pick: Add an option to prepend a string to the commit message
Date: Sat, 12 Jun 2010 00:58:32 -0500	[thread overview]
Message-ID: <20100612055831.GA2426@burratino> (raw)
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:

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

  reply	other threads:[~2010-06-12  5:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-12  5:07 [PATCH] cherry-pick: Add an option to prepend a string to the commit message Bobby Powers
2010-06-12  5:58 ` Jonathan Nieder [this message]
2010-06-12  6:18   ` Junio C Hamano
2010-06-12  6:28   ` Jeff King
2010-06-12  6:43     ` Bobby Powers
2010-06-12  7:18       ` Jonathan Nieder
2010-06-12  8:19         ` Jeff King
2010-06-14  5:33           ` Junio C Hamano
2010-06-14 18:03         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100612055831.GA2426@burratino \
    --to=jrnieder@gmail.com \
    --cc=bobbypowers@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).