Skip to content

Commit

Permalink
revert: improve success message by adding abbreviated commit sha1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Couder authored and Junio C Hamano committed Jul 16, 2010
1 parent 3b2c5b6 commit f29b5e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions builtin/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions t/t3508-cherry-pick-many-commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand Down

0 comments on commit f29b5e0

Please sign in to comment.