Skip to content

Commit d581eb2

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 74859b0 commit d581eb2

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

t/t7064-wtstatus-pv2.sh

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

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

@@ -667,7 +671,9 @@ EOF
667671
## am_already_exists; AM
668672
EOF
669673
git status --untracked-files=no --short --branch --in-progress >actual &&
670-
test_cmp expected actual
674+
test_cmp expected actual &&
675+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
676+
test_grep "^# branch.inprogress AM$" actual
671677
'
672678

673679

@@ -741,7 +747,9 @@ EOF
741747
## HEAD (no branch); BISECTING
742748
EOF
743749
git status --untracked-files=no --short --branch --in-progress >actual &&
744-
test_cmp expected actual
750+
test_cmp expected actual &&
751+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
752+
test_grep "^# branch.inprogress BISECTING$" actual
745753
'
746754

747755

@@ -834,7 +842,9 @@ EOF
834842
UU main.txt
835843
EOF
836844
git status --untracked-files=no --short --branch --in-progress >actual &&
837-
test_cmp expected actual
845+
test_cmp expected actual &&
846+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
847+
test_grep "^# branch.inprogress CHERRY-PICKING$" actual
838848
'
839849

840850

@@ -968,7 +978,9 @@ EOF
968978
UU to-revert.txt
969979
EOF
970980
git status --untracked-files=no --short --branch --in-progress >actual &&
971-
test_cmp expected actual
981+
test_cmp expected actual &&
982+
git status --untracked-files=no --porcelain=v2 --branch >actual &&
983+
test_grep "^# branch.inprogress REVERTING$" actual
972984
'
973985

974986

wt-status.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,20 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
24132413
}
24142414
}
24152415
}
2416+
if (s->state.merge_in_progress)
2417+
fprintf(s->fp, "# branch.inprogress %s%c", "MERGING", eol);
2418+
if (s->state.am_in_progress)
2419+
fprintf(s->fp, "# branch.inprogress %s%c", "AM", eol);
2420+
if (s->state.rebase_in_progress)
2421+
fprintf(s->fp, "# branch.inprogress %s%c", "REBASE-m", eol);
2422+
if (s->state.rebase_interactive_in_progress)
2423+
fprintf(s->fp, "# branch.inprogress %s%c", "REBASE-i", eol);
2424+
if (s->state.cherry_pick_in_progress)
2425+
fprintf(s->fp, "# branch.inprogress %s%c", "CHERRY-PICKING", eol);
2426+
if (s->state.revert_in_progress)
2427+
fprintf(s->fp, "# branch.inprogress %s%c", "REVERTING", eol);
2428+
if (s->state.bisect_in_progress)
2429+
fprintf(s->fp, "# branch.inprogress %s%c", "BISECTING", eol);
24162430
}
24172431

24182432
/*

0 commit comments

Comments
 (0)