Merge branch 'jc/t3404-one-shot-export-fix' into es/test-lint-one-shot-export
[git] / t / t4044-diff-index-unique-abbrev.sh
1 #!/bin/sh
2
3 test_description='test unique sha1 abbreviation on "index from..to" line'
4 . ./test-lib.sh
5
6 if ! test_have_prereq SHA1
7 then
8        skip_all='not using SHA-1 for objects'
9        test_done
10 fi
11
12 cat >expect_initial <<EOF
13 100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1    foo
14 EOF
15
16 cat >expect_update <<EOF
17 100644 blob 51d2738efb4ad8a1e40bed839ab8e116f0a15e47    foo
18 EOF
19
20 test_expect_success 'setup' '
21         echo 4827 > foo &&
22         git add foo &&
23         git commit -m "initial" &&
24         git cat-file -p HEAD: > actual &&
25         test_cmp expect_initial actual &&
26         echo 11742 > foo &&
27         git commit -a -m "update" &&
28         git cat-file -p HEAD: > actual &&
29         test_cmp expect_update actual
30 '
31
32 cat >expect <<EOF
33 index 51d27384..51d2738e 100644
34 EOF
35
36 test_expect_success 'diff does not produce ambiguous index line' '
37         git diff HEAD^..HEAD | grep index > actual &&
38         test_cmp expect actual
39 '
40
41 test_done