summaryrefslogtreecommitdiff
path: root/t/t6038-merge-text-auto.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-08-05 11:13:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-06 16:20:00 (GMT)
commitbeeeb45493332f38de2a3b58120c5bebb5863577 (patch)
treecbee01b0038ca689c309580ef6e3302f62b9c266 /t/t6038-merge-text-auto.sh
parentd347cee4deda2e740f3c9e0046a86b46debdaeb8 (diff)
downloadgit-beeeb45493332f38de2a3b58120c5bebb5863577.zip
git-beeeb45493332f38de2a3b58120c5bebb5863577.tar.gz
git-beeeb45493332f38de2a3b58120c5bebb5863577.tar.bz2
t6038 (merge.renormalize): check that it can be turned off
An unusual sort of person (not me) may even enjoy the conflicts from line-ending changes. But more importantly, it is useful to document that behavior so we can more easily notice if it changes in an uncontrolled way while no one is watching. Cc: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6038-merge-text-auto.sh')
-rwxr-xr-xt/t6038-merge-text-auto.sh50
1 files changed, 49 insertions, 1 deletions
diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index a7ea4b6..52d0dc4 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -15,7 +15,6 @@ test_description='CRLF merge conflict across text=auto change
. ./test-lib.sh
test_expect_success setup '
- git config merge.renormalize true &&
git config core.autocrlf false &&
echo first line | append_cr >file &&
@@ -59,12 +58,19 @@ test_expect_success setup '
git checkout master
'
+test_expect_success 'set up fuzz_conflict() helper' '
+ fuzz_conflict() {
+ sed -e "s/^\([<>=]......\) .*/\1/" "$@"
+ }
+'
+
test_expect_success 'Merge after setting text=auto' '
cat <<-\EOF >expected &&
first line
same line
EOF
+ git config merge.renormalize true &&
git rm -fr . &&
rm -f .gitattributes &&
git reset --hard a &&
@@ -78,6 +84,7 @@ test_expect_success 'Merge addition of text=auto' '
same line
EOF
+ git config merge.renormalize true &&
git rm -fr . &&
rm -f .gitattributes &&
git reset --hard b &&
@@ -85,12 +92,51 @@ test_expect_success 'Merge addition of text=auto' '
test_cmp expected file
'
+test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
+ q_to_cr <<-\EOF >expected &&
+ <<<<<<<
+ first line
+ same line
+ =======
+ first lineQ
+ same lineQ
+ >>>>>>>
+ EOF
+
+ git config merge.renormalize false &&
+ rm -f .gitattributes &&
+ git reset --hard a &&
+ test_must_fail git merge b &&
+ fuzz_conflict file >file.fuzzy &&
+ test_cmp expected file.fuzzy
+'
+
+test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
+ q_to_cr <<-\EOF >expected &&
+ <<<<<<<
+ first lineQ
+ same lineQ
+ =======
+ first line
+ same line
+ >>>>>>>
+ EOF
+
+ git config merge.renormalize false &&
+ rm -f .gitattributes &&
+ git reset --hard b &&
+ test_must_fail git merge a &&
+ fuzz_conflict file >file.fuzzy &&
+ test_cmp expected file.fuzzy
+'
+
test_expect_failure 'checkout -m after setting text=auto' '
cat <<-\EOF >expected &&
first line
same line
EOF
+ git config merge.renormalize true &&
git rm -fr . &&
rm -f .gitattributes &&
git reset --hard initial &&
@@ -105,6 +151,7 @@ test_expect_failure 'checkout -m addition of text=auto' '
same line
EOF
+ git config merge.renormalize true &&
git rm -fr . &&
rm -f .gitattributes file &&
git reset --hard initial &&
@@ -119,6 +166,7 @@ test_expect_failure 'cherry-pick patch from after text=auto was added' '
same line
EOF
+ git config merge.renormalize true &&
git rm -fr . &&
git reset --hard b &&
test_must_fail git cherry-pick a >err 2>&1 &&