1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| | #!/bin/sh
test_description='git add --no-filters
This test creates a file and a corresponding .gitattributes setup
to ensure the file undergoes a conversion when committed or checked
out.
It then verifies that the conversion happens by default, but does not
when --no-filters is used.'
. ./test-lib.sh
test_expect_success setup '
echo "* eol=crlf" > .gitattributes &&
git add .gitattributes &&
git commit -m initial &&
printf "test\r\ntest\r\n" > test
'
test_expect_success 'add without --no-filters' '
original="$(git hash-object --stdin < test)" &&
converted="$(git hash-object test)" &&
git add test &&
git ls-files -s > actual &&
cat > expected <<-EOF &&
100644 $(git hash-object .gitattributes) 0 .gitattributes
100644 $converted 0 test
EOF
test_cmp expected actual
'
test_expect_success 'add with --no-filters' '
git rm -f --cached test &&
original="$(git hash-object --stdin < test)" &&
converted="$(git hash-object test)" &&
git add --no-filters test &&
git ls-files -s > actual &&
cat > expected <<-EOF &&
100644 $(git hash-object .gitattributes) 0 .gitattributes
100644 $original 0 test
EOF
test_cmp expected actual
'
test_done
|