aboutsummaryrefslogtreecommitdiff
path: root/t/t0020-crlf.sh
diff options
context:
space:
mode:
authorKristian Amlie <kristian.amlie@nokia.com>2009-03-20 10:32:09 +0100
committerJunio C Hamano <gitster@pobox.com>2009-03-20 09:36:16 -0700
commitb997045e01c2f12ac7dc44c487915f8e50da4d4d (patch)
treeb7f67d4dd07f25d263ce8a829c03e486b79c49f0 /t/t0020-crlf.sh
parent06f33c1735bf76e02f3e2601cde5161e969872a7 (diff)
downloadgit-b997045e01c2f12ac7dc44c487915f8e50da4d4d.tar.gz
git-b997045e01c2f12ac7dc44c487915f8e50da4d4d.tar.xz
Add a test for checking whether gitattributes is honored by checkout.
The original bug will not honor new entries in gitattributes if they are changed in the same checkout as the files they affect. It will also keep using .gitattributes, even if it is deleted in the same commit as the files it affects. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0020-crlf.sh')
-rwxr-xr-xt/t0020-crlf.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 1be7446d8..4e72b5314 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -429,6 +429,37 @@ test_expect_success 'in-tree .gitattributes (4)' '
}
'
+test_expect_success 'checkout with existing .gitattributes' '
+
+ git config core.autocrlf true &&
+ git config --unset core.safecrlf &&
+ echo ".file2 -crlfQ" | q_to_cr >> .gitattributes &&
+ git add .gitattributes &&
+ git commit -m initial &&
+ echo ".file -crlfQ" | q_to_cr >> .gitattributes &&
+ echo "contents" > .file &&
+ git add .gitattributes .file &&
+ git commit -m second &&
+
+ git checkout master~1 &&
+ git checkout master &&
+ test "$(git diff-files --raw)" = ""
+
+'
+
+test_expect_success 'checkout when deleting .gitattributes' '
+
+ git rm .gitattributes &&
+ echo "contentsQ" | q_to_cr > .file2 &&
+ git add .file2 &&
+ git commit -m third
+
+ git checkout master~1 &&
+ git checkout master &&
+ remove_cr .file2 >/dev/null
+
+'
+
test_expect_success 'invalid .gitattributes (must not crash)' '
echo "three +crlf" >>.gitattributes &&