From e0af48e49682ea3345f932f6b9e7fa7c5e5e611a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 28 Aug 2008 01:10:04 -0700 Subject: xdiff-merge: optionally show conflicts in "diff3 -m" style When showing conflicting merges, we traditionally followed RCS's merge output format. The output shows: <<<<<<< postimage from one side; ======= postimage of the other side; and >>>>>>> Some poeple find it easier to be able to understand what is going on when they can view the common ancestor's version, which is used by "diff3 -m", which shows: <<<<<<< postimage from one side; ||||||| shared preimage; ======= postimage of the other side; and >>>>>>> This is an initial step to bring that as an optional feature to git. Only "git merge-file" has been converted, with "--diff3" option. Signed-off-by: Junio C Hamano --- t/t6023-merge-file.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 't/t6023-merge-file.sh') diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index f674c48cab..20786ce79d 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -161,4 +161,41 @@ test_expect_success 'ZEALOUS_ALNUM' ' ' +cat >expect <<\EOF +Dominus regit me, +<<<<<<< new8.txt +et nihil mihi deerit; + + + + +In loco pascuae ibi me collocavit; +super aquam refectionis educavit me. +||||||| +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +======= +et nihil mihi deerit, + + + + +In loco pascuae ibi me collocavit -- +super aquam refectionis educavit me, +>>>>>>> new9.txt +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam TU mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF + +test_expect_success '"diff3 -m" style output' ' + test_must_fail git merge-file -p --diff3 \ + new8.txt new5.txt new9.txt >actual && + test_cmp expect actual +' + test_done -- cgit v1.2.1 From b541248467fa47979a34e3f1c5bbe3308fbdc4d1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 29 Aug 2008 10:49:56 -0700 Subject: merge.conflictstyle: choose between "merge" and "diff3 -m" styles This teaches "git merge-file" to honor merge.conflictstyle configuration variable, whose value can be "merge" (default) or "diff3". Signed-off-by: Junio C Hamano --- t/t6023-merge-file.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 't/t6023-merge-file.sh') diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index 20786ce79d..b76bca8880 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -192,10 +192,17 @@ non timebo mala, quoniam TU mecum es: virga tua et baculus tuus ipsa me consolata sunt. EOF -test_expect_success '"diff3 -m" style output' ' +test_expect_success '"diff3 -m" style output (1)' ' test_must_fail git merge-file -p --diff3 \ new8.txt new5.txt new9.txt >actual && test_cmp expect actual ' +test_expect_success '"diff3 -m" style output (2)' ' + git config merge.conflictstyle diff3 && + test_must_fail git merge-file -p \ + new8.txt new5.txt new9.txt >actual && + test_cmp expect actual +' + test_done -- cgit v1.2.1