Skip to content

Commit 8dc874b

Browse files
Stephen P. Smithgitster
authored andcommitted
wt-status.c: set commitable bit if there is a meaningful merge.
The 'commit --dry-run' and 'commit' return values differed if a conflicted merge had been resolved and the resulting commit would record the same tree as the parent. Update show_merge_in_progress to set the commitable bit if conflicts have been resolved and a merge is in progress. Signed-off-by: Stephen P. Smith <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a2558fb commit 8dc874b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

t/t7501-commit.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,4 +587,24 @@ test_expect_success '--only works on to-be-born branch' '
587587
test_cmp expected actual
588588
'
589589

590+
test_expect_success '--dry-run with conflicts fixed from a merge' '
591+
# setup two branches with conflicting information
592+
# in the same file, resolve the conflict,
593+
# call commit with --dry-run
594+
echo "Initial contents, unimportant" >test-file &&
595+
git add test-file &&
596+
git commit -m "Initial commit" &&
597+
echo "commit-1-state" >test-file &&
598+
git commit -m "commit 1" -i test-file &&
599+
git tag commit-1 &&
600+
git checkout -b branch-2 HEAD^1 &&
601+
echo "commit-2-state" >test-file &&
602+
git commit -m "commit 2" -i test-file &&
603+
! $(git merge --no-commit commit-1) &&
604+
echo "commit-2-state" >test-file &&
605+
git add test-file &&
606+
git commit --dry-run &&
607+
git commit -m "conflicts fixed from merge."
608+
'
609+
590610
test_done

wt-status.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ static void show_merge_in_progress(struct wt_status *s,
949949
status_printf_ln(s, color,
950950
_(" (fix conflicts and run \"git commit\")"));
951951
} else {
952+
s-> commitable = 1;
952953
status_printf_ln(s, color,
953954
_("All conflicts fixed but you are still merging."));
954955
if (s->hints)

0 commit comments

Comments
 (0)