@matheusbsbs / matheus-bagliano / commits / b997045e01
Fork 0

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>

Kristian Amlie committed Mar 20, 2009 at 10:32 UTC b997045e01c2f12ac7dc44c487915f8e50da4d4d
1 file changed +31
t/t0020-crlf.sh
+31
@@ -429,6 +429,37 @@ test_expect_success 'in-tree .gitattributes (4)' '
429 }
430 '
431
432 +test_expect_success 'checkout with existing .gitattributes' '
433 +
434 + git config core.autocrlf true &&
435 + git config --unset core.safecrlf &&
436 + echo ".file2 -crlfQ" | q_to_cr >> .gitattributes &&
437 + git add .gitattributes &&
438 + git commit -m initial &&
439 + echo ".file -crlfQ" | q_to_cr >> .gitattributes &&
440 + echo "contents" > .file &&
441 + git add .gitattributes .file &&
442 + git commit -m second &&
443 +
444 + git checkout master~1 &&
445 + git checkout master &&
446 + test "$(git diff-files --raw)" = ""
447 +
448 +'
449 +
450 +test_expect_success 'checkout when deleting .gitattributes' '
451 +
452 + git rm .gitattributes &&
453 + echo "contentsQ" | q_to_cr > .file2 &&
454 + git add .file2 &&
455 + git commit -m third
456 +
457 + git checkout master~1 &&
458 + git checkout master &&
459 + remove_cr .file2 >/dev/null
460 +
461 +'
462 +
463 test_expect_success 'invalid .gitattributes (must not crash)' '
464
465 echo "three +crlf" >>.gitattributes &&