Skip to content

Commit 9ce2824

Browse files
committed
Merge branch 'ss/commit-dry-run-resolve-merge-to-no-op'
"git commit --dry-run" reported "No, no, you cannot commit." in one case where "git commit" would have allowed you to commit, and this improves it a little bit ("git commit --dry-run --short" still does not give you the correct answer, for example). This is a stop-gap measure in that "commit --short --dry-run" still gives an incorrect result. * ss/commit-dry-run-resolve-merge-to-no-op: wt-status.c: set commitable bit if there is a meaningful merge.
2 parents 3916adf + 8dc874b commit 9ce2824

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
@@ -607,4 +607,24 @@ test_expect_success '--only works on to-be-born branch' '
607607
test_cmp expected actual
608608
'
609609

610+
test_expect_success '--dry-run with conflicts fixed from a merge' '
611+
# setup two branches with conflicting information
612+
# in the same file, resolve the conflict,
613+
# call commit with --dry-run
614+
echo "Initial contents, unimportant" >test-file &&
615+
git add test-file &&
616+
git commit -m "Initial commit" &&
617+
echo "commit-1-state" >test-file &&
618+
git commit -m "commit 1" -i test-file &&
619+
git tag commit-1 &&
620+
git checkout -b branch-2 HEAD^1 &&
621+
echo "commit-2-state" >test-file &&
622+
git commit -m "commit 2" -i test-file &&
623+
! $(git merge --no-commit commit-1) &&
624+
echo "commit-2-state" >test-file &&
625+
git add test-file &&
626+
git commit --dry-run &&
627+
git commit -m "conflicts fixed from merge."
628+
'
629+
610630
test_done

wt-status.c

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

0 commit comments

Comments
 (0)