@matheusbsbs / matheus-bagliano / commits / f29b5e06b3
Fork 0

revert: improve success message by adding abbreviated commit sha1

Instead of saying "Finished one cherry-pick." or "Finished one revert.", we now say "Finished cherry-pick of commit <abbreviated sha1>." or "Finished revert of commit <abbreviated sha1>." which is more informative, especially when cherry-picking or reverting many commits. In case of failure the message is now "Automatic cherry-pick of commit <abbreviated sha1> failed." instead of "Automatic cherry-pick failed." Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Jul 14, 2010 at 01:28 UTC f29b5e06b3bdbe3c66a01db8ee67e3c87ae55705
2 files changed +11 -10
builtin/revert.c
+3 -2
@@ -492,7 +492,8 @@ static int do_pick_commit(void)
492 }
493 }
494
495 - strbuf_addstr(&mebuf, me);
495 + strbuf_addf(&mebuf, "%s of commit %s", me,
496 + find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
497
498 if (!strategy || !strcmp(strategy, "recursive") || action == REVERT) {
499 res = do_recursive_merge(base, next, base_label, next_label,
@@ -521,7 +522,7 @@ static int do_pick_commit(void)
522 if (!no_commit)
523 res = run_git_commit(defmsg);
524 if (!res)
524 - fprintf(stderr, "Finished one %s.\n", mebuf.buf);
525 + fprintf(stderr, "Finished %s.\n", mebuf.buf);
526 }
527
528 strbuf_release(&mebuf);
t/t3508-cherry-pick-many-commits.sh
+8 -8
@@ -23,10 +23,10 @@ test_expect_success setup '
23 '
24
25 test_expect_success 'cherry-pick first..fourth works' '
26 - cat <<-\EOF >expected &&
27 - Finished one cherry-pick.
28 - Finished one cherry-pick.
29 - Finished one cherry-pick.
26 + cat <<-EOF >expected &&
27 + Finished cherry-pick of commit $(git rev-parse --short second).
28 + Finished cherry-pick of commit $(git rev-parse --short third).
29 + Finished cherry-pick of commit $(git rev-parse --short fourth).
30 EOF
31
32 git checkout -f master &&
@@ -40,10 +40,10 @@ test_expect_success 'cherry-pick first..fourth works' '
40 '
41
42 test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
43 - cat <<-\EOF >expected &&
44 - Finished one cherry-pick with strategy resolve.
45 - Finished one cherry-pick with strategy resolve.
46 - Finished one cherry-pick with strategy resolve.
43 + cat <<-EOF >expected &&
44 + Finished cherry-pick of commit $(git rev-parse --short second) with strategy resolve.
45 + Finished cherry-pick of commit $(git rev-parse --short third) with strategy resolve.
46 + Finished cherry-pick of commit $(git rev-parse --short fourth) with strategy resolve.
47 EOF
48
49 git checkout -f master &&