git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC] cherry-pick: Suggest a better method to retain authorship

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 4, 2007, 13:26 UTC
Message-ID
<Pine.LNX.4.63.0703041425280.22628@wbgn013.biozentrum.uni-wuerzburg.de>

When a cherry-pick failed, we used to recommend setting environment variables to retain the authorship. It is much easier, though, to use the "-c" flag of git-commit.

Print this message also when merge-recursive fails (the code used to exit(1) in that case, never reaching the proper failure path).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 builtin-revert.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/builtin-revert.c b/builtin-revert.c
index bc3cfcb..382fe0c 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -323,9 +323,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 
 	if (merge_recursive(sha1_to_hex(base->object.sha1),
 				sha1_to_hex(head), "HEAD",
-				sha1_to_hex(next->object.sha1), oneline))
-		exit(1);
-	if (write_tree(head, 0, NULL)) {
+				sha1_to_hex(next->object.sha1), oneline) ||
+			write_tree(head, 0, NULL)) {
 		const char *target = git_path("MERGE_MSG");
 		add_to_msg("\nConflicts:\n\n");
 		read_cache();
@@ -350,16 +349,10 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 			"mark the corrected paths with 'git-add <paths>'\n"
 			"and commit the result.\n", me);
 		if (action == CHERRY_PICK) {
-			fprintf(stderr, "You may choose to use the following "
-				"when making the commit:\n"
-				"GIT_AUTHOR_NAME=\"%s\"\n",
-				getenv("GIT_AUTHOR_NAME"));
-			fprintf(stderr, "GIT_AUTHOR_EMAIL=\"%s\"\n",
-				getenv("GIT_AUTHOR_EMAIL"));
-			fprintf(stderr, "GIT_AUTHOR_DATE=\"%s\"\n"
-				"export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL "
-				"GIT_AUTHOR_DATE\n",
-				getenv("GIT_AUTHOR_DATE"));
+			fprintf(stderr, "When commiting, use the option "
+				"'-c %s' to retain authorship and message.\n",
+				find_unique_abbrev(commit->object.sha1,
+					DEFAULT_ABBREV));
 		}
 		exit(1);
 	}
-- 
1.5.0.2.2531.g5a43-dirty
Message 1 of 1 in “cherry-pick: Suggest a better method to retain authorship”
  1. cherry-pick: Suggest a better method to retain authorshipJohannes Schindelin, Mar 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.