Skip to content

Commit e0a829f

Browse files
committed
status: show in-progress info for porcelain v2
Porcelain v2 format is intended to be extendable. So we add in-progress information unconditionally to the branch information (in case that is shown at all). Note that - in contrast to the short status info - we add all available information in case multiple operations are in progress, and we do so by outputting one line per operation.
1 parent 5dd0021 commit e0a829f

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

t/t7064-wtstatus-pv2.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ test_expect_success 'verify AA (add-add) conflict' '
295295
cat >expect <<-EOF &&
296296
# branch.oid $HM
297297
# branch.head AA_M
298+
# branch.inprogress MERGING
298299
u AA N... 000000 100644 100644 100644 $ZERO_OID $OID_AA_B $OID_AA_A conflict.txt
299300
EOF
300301
@@ -335,6 +336,7 @@ test_expect_success 'verify UU (edit-edit) conflict' '
335336
cat >expect <<-EOF &&
336337
# branch.oid $HM
337338
# branch.head UU_M
339+
# branch.inprogress MERGING
338340
u UU N... 100644 100644 100644 100644 $OID_UU_ANC $OID_UU_B $OID_UU_A conflict.txt
339341
EOF
340342

t/t7512-status-help.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ EOF
9999
UU main.txt
100100
EOF
101101
git status --untracked-files=no --short --branch --in-progress >actual &&
102-
test_cmp expected actual
102+
test_cmp expected actual &&
103+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
104+
test_grep "^# branch.inprogress REBASE-m$" actual
103105
'
104106

105107

@@ -166,7 +168,9 @@ EOF
166168
UU main.txt
167169
EOF
168170
git status --untracked-files=no --short --branch --in-progress >actual &&
169-
test_cmp expected actual
171+
test_cmp expected actual &&
172+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
173+
test_grep "^# branch.inprogress REBASE-i$" actual
170174
'
171175

172176

@@ -636,7 +640,9 @@ EOF
636640
## am_already_exists; AM
637641
EOF
638642
git status --untracked-files=no --short --branch --in-progress >actual &&
639-
test_cmp expected actual
643+
test_cmp expected actual &&
644+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
645+
test_grep "^# branch.inprogress AM$" actual
640646
'
641647

642648

@@ -710,7 +716,9 @@ EOF
710716
## HEAD (no branch); BISECTING
711717
EOF
712718
git status --untracked-files=no --short --branch --in-progress >actual &&
713-
test_cmp expected actual
719+
test_cmp expected actual &&
720+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
721+
test_grep "^# branch.inprogress BISECTING$" actual
714722
'
715723

716724

@@ -803,7 +811,9 @@ EOF
803811
UU main.txt
804812
EOF
805813
git status --untracked-files=no --short --branch --in-progress >actual &&
806-
test_cmp expected actual
814+
test_cmp expected actual &&
815+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
816+
test_grep "^# branch.inprogress CHERRY-PICKING$" actual
807817
'
808818

809819

@@ -937,7 +947,9 @@ EOF
937947
UU to-revert.txt
938948
EOF
939949
git status --untracked-files=no --short --branch --in-progress >actual &&
940-
test_cmp expected actual
950+
test_cmp expected actual &&
951+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
952+
test_grep "^# branch.inprogress REVERTING$" actual
941953
'
942954

943955

wt-status.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,20 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
23022302
}
23032303
}
23042304
}
2305+
if (s->state.merge_in_progress)
2306+
fprintf(s->fp, "# branch.inprogress %s%c", "MERGING", eol);
2307+
if (s->state.am_in_progress)
2308+
fprintf(s->fp, "# branch.inprogress %s%c", "AM", eol);
2309+
if (s->state.rebase_in_progress)
2310+
fprintf(s->fp, "# branch.inprogress %s%c", "REBASE-m", eol);
2311+
if (s->state.rebase_interactive_in_progress)
2312+
fprintf(s->fp, "# branch.inprogress %s%c", "REBASE-i", eol);
2313+
if (s->state.cherry_pick_in_progress)
2314+
fprintf(s->fp, "# branch.inprogress %s%c", "CHERRY-PICKING", eol);
2315+
if (s->state.revert_in_progress)
2316+
fprintf(s->fp, "# branch.inprogress %s%c", "REVERTING", eol);
2317+
if (s->state.bisect_in_progress)
2318+
fprintf(s->fp, "# branch.inprogress %s%c", "BISECTING", eol);
23052319
}
23062320

23072321
/*

0 commit comments

Comments
 (0)