From f29b5e06b3bdbe3c66a01db8ee67e3c87ae55705 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Wed, 14 Jul 2010 01:28:15 +0200 Subject: [PATCH] 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 ." or "Finished revert of commit ." 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 failed." instead of "Automatic cherry-pick failed." Signed-off-by: Christian Couder Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- builtin/revert.c | 5 +++-- t/t3508-cherry-pick-many-commits.sh | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index ec931bdcfc..e261fb2391 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -492,7 +492,8 @@ static int do_pick_commit(void) } } - strbuf_addstr(&mebuf, me); + strbuf_addf(&mebuf, "%s of commit %s", me, + find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV)); if (!strategy || !strcmp(strategy, "recursive") || action == REVERT) { res = do_recursive_merge(base, next, base_label, next_label, @@ -521,7 +522,7 @@ static int do_pick_commit(void) if (!no_commit) res = run_git_commit(defmsg); if (!res) - fprintf(stderr, "Finished one %s.\n", mebuf.buf); + fprintf(stderr, "Finished %s.\n", mebuf.buf); } strbuf_release(&mebuf); diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh index d90b365fd2..6044173007 100755 --- a/t/t3508-cherry-pick-many-commits.sh +++ b/t/t3508-cherry-pick-many-commits.sh @@ -23,10 +23,10 @@ test_expect_success setup ' ' test_expect_success 'cherry-pick first..fourth works' ' - cat <<-\EOF >expected && - Finished one cherry-pick. - Finished one cherry-pick. - Finished one cherry-pick. + cat <<-EOF >expected && + Finished cherry-pick of commit $(git rev-parse --short second). + Finished cherry-pick of commit $(git rev-parse --short third). + Finished cherry-pick of commit $(git rev-parse --short fourth). EOF git checkout -f master && @@ -40,10 +40,10 @@ test_expect_success 'cherry-pick first..fourth works' ' ' test_expect_success 'cherry-pick --strategy resolve first..fourth works' ' - cat <<-\EOF >expected && - Finished one cherry-pick with strategy resolve. - Finished one cherry-pick with strategy resolve. - Finished one cherry-pick with strategy resolve. + cat <<-EOF >expected && + Finished cherry-pick of commit $(git rev-parse --short second) with strategy resolve. + Finished cherry-pick of commit $(git rev-parse --short third) with strategy resolve. + Finished cherry-pick of commit $(git rev-parse --short fourth) with strategy resolve. EOF git checkout -f master && -- 2.11.4.GIT