e46663473200635749429001a407260aeb5f1b09
1#!/bin/sh
2
3test_description='git cat-file filters support'
4. ./test-lib.sh
5
6test_expect_success 'setup ' '
7 echo "*.txt eol=crlf diff=txt" >.gitattributes &&
8 echo "hello" | append_cr >world.txt &&
9 git add .gitattributes world.txt &&
10 test_tick &&
11 git commit -m "Initial commit"
12'
13
14has_cr () {
15 tr '\015' Q <"$1" | grep Q >/dev/null
16}
17
18test_expect_success 'no filters with `git show`' '
19 git show HEAD:world.txt >actual &&
20 ! has_cr actual
21
22'
23
24test_expect_success 'no filters with cat-file' '
25 git cat-file blob HEAD:world.txt >actual &&
26 ! has_cr actual
27'
28
29test_expect_success 'cat-file --filters converts to worktree version' '
30 git cat-file --filters HEAD:world.txt >actual &&
31 has_cr actual
32'
33
34test_done