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]

 



On Sat, Jun 12, 2010 at 12:58:32AM -0500, Jonathan Nieder wrote:

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

What bothers me is how specific this munging is. What if I want to
append to the message? Or put something after the subject line, but
before the commit body? Or add a pseudo-header (like signed-off-by) to
the set of pseudo-headers at the end, properly adding a newline if it is
the first such pseudo-header.

FWIW, we can already do this kind of stuff with:

  GIT_EDITOR="sed -i 1i$prefix" git cherry-pick -e $ref

or

  git cherry-pick -n $ref &&
  sed -i 1i$prefix .git/MERGE_MSG
  GIT_EDITOR=true git commit

I'll admit the first one is not very intuitive. But it is easy to script
around the second form. For one of my examples, I would probably do:

  git cherry-pick -n $ref &&
  git log -1 --format='%s%n%ncontent between subject and body%n%b' |
  git commit -F -

The specifics aren't important, but I think you can see that the "don't
commit automatically, make a message as you like, and then use the
regular message-specifiers for commit to commit it" technique is pretty
straightforward and very flexible.

It's obviously more typing for occasional interactive use, but in that
case, why not just use "git cherry-pick -e" and use your editor?

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