cherry-pick: Suggest a better method to retain authorship
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Mar 4, 2007 at 14:26 UTC
f52463a58275c8dd12b26b02bc0388d015547fcc
1 file changed
+6
-13
builtin-revert.c
+6
-13
@@ -323,9 +323,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
323
324
if (merge_recursive(sha1_to_hex(base->object.sha1),
325
sha1_to_hex(head), "HEAD",
326
- sha1_to_hex(next->object.sha1), oneline))
327
- exit(1);
328
- if (write_tree(head, 0, NULL)) {
326
+ sha1_to_hex(next->object.sha1), oneline) ||
327
+ write_tree(head, 0, NULL)) {
328
const char *target = git_path("MERGE_MSG");
329
add_to_msg("\nConflicts:\n\n");
330
read_cache();
@@ -350,16 +349,10 @@ static int revert_or_cherry_pick(int argc, const char **argv)
349
"mark the corrected paths with 'git-add <paths>'\n"
350
"and commit the result.\n", me);
351
if (action == CHERRY_PICK) {
353
- fprintf(stderr, "You may choose to use the following "
354
- "when making the commit:\n"
355
- "GIT_AUTHOR_NAME=\"%s\"\n",
356
- getenv("GIT_AUTHOR_NAME"));
357
- fprintf(stderr, "GIT_AUTHOR_EMAIL=\"%s\"\n",
358
- getenv("GIT_AUTHOR_EMAIL"));
359
- fprintf(stderr, "GIT_AUTHOR_DATE=\"%s\"\n"
360
- "export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL "
361
- "GIT_AUTHOR_DATE\n",
362
- getenv("GIT_AUTHOR_DATE"));
352
+ fprintf(stderr, "When commiting, use the option "
353
+ "'-c %s' to retain authorship and message.\n",
354
+ find_unique_abbrev(commit->object.sha1,
355
+ DEFAULT_ABBREV));
356
}
357
exit(1);
358
}