rebase: teach --autosquash to match on sha1 in addition to message
[git/kirr.git] / t / t8006-blame-textconv.sh
blob9ad96d4d32390081ba97c336d80b2294cf69dc44
1 #!/bin/sh
3 test_description='git blame textconv support'
4 . ./test-lib.sh
6 find_blame() {
7 sed -e 's/^[^(]*//'
10 cat >helper <<'EOF'
11 #!/bin/sh
12 sed 's/^/converted: /' "$@"
13 EOF
14 chmod +x helper
16 test_expect_success 'setup ' '
17 echo test 1 >one.bin &&
18 echo test number 2 >two.bin &&
19 git add . &&
20 GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" &&
21 echo test 1 version 2 >one.bin &&
22 echo test number 2 version 2 >>two.bin &&
23 GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00"
26 cat >expected <<EOF
27 (Number2 2010-01-01 20:00:00 +0000 1) test 1 version 2
28 EOF
30 test_expect_success 'no filter specified' '
31 git blame one.bin >blame &&
32 find_blame Number2 <blame >result &&
33 test_cmp expected result
36 test_expect_success 'setup textconv filters' '
37 echo "*.bin diff=test" >.gitattributes &&
38 git config diff.test.textconv ./helper &&
39 git config diff.test.cachetextconv false
42 test_expect_success 'blame with --no-textconv' '
43 git blame --no-textconv one.bin >blame &&
44 find_blame <blame> result &&
45 test_cmp expected result
48 cat >expected <<EOF
49 (Number2 2010-01-01 20:00:00 +0000 1) converted: test 1 version 2
50 EOF
52 test_expect_success 'basic blame on last commit' '
53 git blame one.bin >blame &&
54 find_blame <blame >result &&
55 test_cmp expected result
58 cat >expected <<EOF
59 (Number1 2010-01-01 18:00:00 +0000 1) converted: test number 2
60 (Number2 2010-01-01 20:00:00 +0000 2) converted: test number 2 version 2
61 EOF
63 test_expect_success 'blame --textconv going through revisions' '
64 git blame --textconv two.bin >blame &&
65 find_blame <blame >result &&
66 test_cmp expected result
69 test_expect_success 'make a new commit' '
70 echo "test number 2 version 3" >>two.bin &&
71 GIT_AUTHOR_NAME=Number3 git commit -a -m Third --date="2010-01-01 22:00:00"
74 test_expect_success 'blame from previous revision' '
75 git blame HEAD^ two.bin >blame &&
76 find_blame <blame >result &&
77 test_cmp expected result
80 test_done