summaryrefslogtreecommitdiff
path: root/t/t8010-cat-file-filters.sh
blob: e46663473200635749429001a407260aeb5f1b09 (plain)
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
#!/bin/sh
 
test_description='git cat-file filters support'
. ./test-lib.sh
 
test_expect_success 'setup ' '
	echo "*.txt eol=crlf diff=txt" >.gitattributes &&
	echo "hello" | append_cr >world.txt &&
	git add .gitattributes world.txt &&
	test_tick &&
	git commit -m "Initial commit"
'
 
has_cr () {
	tr '\015' Q <"$1" | grep Q >/dev/null
}
 
test_expect_success 'no filters with `git show`' '
	git show HEAD:world.txt >actual &&
	! has_cr actual
 
'
 
test_expect_success 'no filters with cat-file' '
	git cat-file blob HEAD:world.txt >actual &&
	! has_cr actual
'
 
test_expect_success 'cat-file --filters converts to worktree version' '
	git cat-file --filters HEAD:world.txt >actual &&
	has_cr actual
'
 
test_done