# [PATCH] cherry-pick: Bug fix 'cherry picked from' message.

3 messages from 2007-03-06 to 2007-03-06. Participants: Shawn O. Pearce, Junio C Hamano, Johannes Schindelin.
Thread: https://gitlist.dev/t/7104

## Shawn O. Pearce, 2007-03-06 05:46

Subject: [PATCH] cherry-pick: Bug fix 'cherry picked from' message.
Message-ID: <20070306054600.GA24206@spearce.org>
URL: https://gitlist.dev/e/20070306054600.GA24206%40spearce.org

```
Somewhere along the line (in abd6970a) git-revert.sh learned to
omit the private object name from the new commit message *unless*
-x was supplied on the command line by the user.

The way this was implemented is really non-obvious in the original
script.  Setting replay=t (the default) means we don't include the
the private object name, while setting reply='' (the -x flag) means
we should include the private object name.  These two settings now
relate to the replay=1 and replay=0 cases in the C version, so we
need to negate replay to test it is 0.

I also noticed the C version was adding an extra LF in the -x case,
where the older git-revert.sh was not.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 builtin-revert.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin-revert.c b/builtin-revert.c
index 382fe0c..2f2dc1b 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -303,8 +303,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 		next = commit;
 		set_author_ident_env(message);
 		add_message_to_msg(message);
-		if (replay) {
-			add_to_msg("\n(cherry picked from commit ");
+		if (!replay) {
+			add_to_msg("(cherry picked from commit ");
 			add_to_msg(sha1_to_hex(commit->object.sha1));
 			add_to_msg(")\n");
 		}
-- 
1.5.0.3.863.gf0989

```

## Junio C Hamano, 2007-03-06 06:53

Subject: Re: [PATCH] cherry-pick: Bug fix 'cherry picked from' message.
Message-ID: <7vabyqual4.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vabyqual4.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070306054600.GA24206@spearce.org>

```
Thanks.

```

## Johannes Schindelin, 2007-03-06 11:03

Subject: Re: [PATCH] cherry-pick: Bug fix 'cherry picked from' message.
Message-ID: <Pine.LNX.4.63.0703061203130.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0703061203130.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <20070306054600.GA24206@spearce.org>

```
Hi Shawn,

thanks for the fixup!

Ciao,
Dscho

```
