status: show commit sha1 in "You are currently cherry-picking" message
Especially helpful when cherry-picking multiple commits. Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Ralf Thielow committed
Oct 11, 2013 at 17:58 UTC
bffd8098705ffcfeb267951dcdd4e49dd188a7bb
3 files changed
+12
-6
t/t7512-status-help.sh
+6
-4
@@ -626,9 +626,10 @@ test_expect_success 'prepare for cherry-pick conflicts' '
626
test_expect_success 'status when cherry-picking before resolving conflicts' '
627
test_when_finished "git cherry-pick --abort" &&
628
test_must_fail git cherry-pick cherry_branch_second &&
629
- cat >expected <<\EOF &&
629
+ TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&
630
+ cat >expected <<EOF &&
631
On branch cherry_branch
631
-You are currently cherry-picking.
632
+You are currently cherry-picking commit $TO_CHERRY_PICK.
633
(fix conflicts and run "git cherry-pick --continue")
634
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
635
@@ -648,11 +649,12 @@ test_expect_success 'status when cherry-picking after resolving conflicts' '
649
git reset --hard cherry_branch &&
650
test_when_finished "git cherry-pick --abort" &&
651
test_must_fail git cherry-pick cherry_branch_second &&
652
+ TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&
653
echo end >main.txt &&
654
git add main.txt &&
653
- cat >expected <<\EOF &&
655
+ cat >expected <<EOF &&
656
On branch cherry_branch
655
-You are currently cherry-picking.
657
+You are currently cherry-picking commit $TO_CHERRY_PICK.
658
(all conflicts fixed: run "git cherry-pick --continue")
659
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
660
wt-status.c
+5
-2
@@ -996,7 +996,8 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
996
struct wt_status_state *state,
997
const char *color)
998
{
999
- status_printf_ln(s, color, _("You are currently cherry-picking."));
999
+ status_printf_ln(s, color, _("You are currently cherry-picking commit %s."),
1000
+ find_unique_abbrev(state->cherry_pick_head_sha1, DEFAULT_ABBREV));
1001
if (s->hints) {
1002
if (has_unmerged(s))
1003
status_printf_ln(s, color,
@@ -1169,8 +1170,10 @@ void wt_status_get_state(struct wt_status_state *state,
1170
state->rebase_in_progress = 1;
1171
state->branch = read_and_strip_branch("rebase-merge/head-name");
1172
state->onto = read_and_strip_branch("rebase-merge/onto");
1172
- } else if (!stat(git_path("CHERRY_PICK_HEAD"), &st)) {
1173
+ } else if (!stat(git_path("CHERRY_PICK_HEAD"), &st) &&
1174
+ !get_sha1("CHERRY_PICK_HEAD", sha1)) {
1175
state->cherry_pick_in_progress = 1;
1176
+ hashcpy(state->cherry_pick_head_sha1, sha1);
1177
}
1178
if (!stat(git_path("BISECT_LOG"), &st)) {
1179
state->bisect_in_progress = 1;
wt-status.h
+1
@@ -88,6 +88,7 @@ struct wt_status_state {
88
char *detached_from;
89
unsigned char detached_sha1[20];
90
unsigned char revert_head_sha1[20];
91
+ unsigned char cherry_pick_head_sha1[20];
92
};
93
94
void wt_status_prepare(struct wt_status *s);