Merge branch 'bw/ref-prefix-for-configured-refspec'
[git/raj.git] / t / t4044-diff-index-unique-abbrev.sh
blob647905e01fb963efce34cd30b351a31a671cbb5e
1 #!/bin/sh
3 test_description='test unique sha1 abbreviation on "index from..to" line'
4 . ./test-lib.sh
6 if ! test_have_prereq SHA1
7 then
8 skip_all='not using SHA-1 for objects'
9 test_done
12 cat >expect_initial <<EOF
13 100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1 foo
14 EOF
16 cat >expect_update <<EOF
17 100644 blob 51d2738efb4ad8a1e40bed839ab8e116f0a15e47 foo
18 EOF
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
32 cat >expect <<EOF
33 index 51d27384..51d2738e 100644
34 EOF
36 test_expect_success 'diff does not produce ambiguous index line' '
37 git diff HEAD^..HEAD | grep index > actual &&
38 test_cmp expect actual
41 test_done