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.
This commit is contained in:
Junio C Hamano 2016-05-23 14:54:28 -07:00
commit 9ce2824e4b
2 changed files with 21 additions and 0 deletions

View File

@ -607,4 +607,24 @@ test_expect_success '--only works on to-be-born branch' '
test_cmp expected actual test_cmp expected actual
' '
test_expect_success '--dry-run with conflicts fixed from a merge' '
# setup two branches with conflicting information
# in the same file, resolve the conflict,
# call commit with --dry-run
echo "Initial contents, unimportant" >test-file &&
git add test-file &&
git commit -m "Initial commit" &&
echo "commit-1-state" >test-file &&
git commit -m "commit 1" -i test-file &&
git tag commit-1 &&
git checkout -b branch-2 HEAD^1 &&
echo "commit-2-state" >test-file &&
git commit -m "commit 2" -i test-file &&
! $(git merge --no-commit commit-1) &&
echo "commit-2-state" >test-file &&
git add test-file &&
git commit --dry-run &&
git commit -m "conflicts fixed from merge."
'
test_done test_done

View File

@ -950,6 +950,7 @@ static void show_merge_in_progress(struct wt_status *s,
status_printf_ln(s, color, status_printf_ln(s, color,
_(" (fix conflicts and run \"git commit\")")); _(" (fix conflicts and run \"git commit\")"));
} else { } else {
s-> commitable = 1;
status_printf_ln(s, color, status_printf_ln(s, color,
_("All conflicts fixed but you are still merging.")); _("All conflicts fixed but you are still merging."));
if (s->hints) if (s->hints)