wt-status.c: set commitable bit if there is a meaningful merge.
authorStephen P. Smith <ischis2@cox.net>
Tue, 16 Feb 2016 02:38:25 +0000 (19:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Feb 2016 16:53:11 +0000 (08:53 -0800)
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 <ischis2@cox.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7501-commit.sh
wt-status.c
index 63e04277f99a08b15e12c3392f9e128147180fad..363abb187e51d60e78f7fe607549873a2dd87aba 100755 (executable)
@@ -587,4 +587,24 @@ test_expect_success '--only works on to-be-born branch' '
        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
index 078a4727435b0c6b98cdc600773cb90e850e9a7f..6be55ae88741516320960a02bbc734dc560a4700 100644 (file)
@@ -949,6 +949,7 @@ static void show_merge_in_progress(struct wt_status *s,
                        status_printf_ln(s, color,
                                _("  (fix conflicts and run \"git commit\")"));
        } else {
+               s-> commitable = 1;
                status_printf_ln(s, color,
                        _("All conflicts fixed but you are still merging."));
                if (s->hints)