]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4044-diff-index-unique-abbrev.sh
Merge branch 'jk/clone-allow-bare-and-o-together'
[thirdparty/git.git] / t / t4044-diff-index-unique-abbrev.sh
CommitLineData
3e5a188f
JH
1#!/bin/sh
2
3test_description='test unique sha1 abbreviation on "index from..to" line'
27472b51
ÆAB
4
5TEST_PASSES_SANITIZE_LEAK=true
3e5a188f
JH
6. ./test-lib.sh
7
38ee26b2 8test_expect_success 'setup' '
9 test_oid_cache <<-EOF &&
10 val1 sha1:4827
11 val1 sha256:5664
3e5a188f 12
38ee26b2 13 val2 sha1:11742
14 val2 sha256:10625
3e5a188f 15
38ee26b2 16 hash1 sha1:51d2738463ea4ca66f8691c91e33ce64b7d41bb1
17 hash1 sha256:ae31dfff0af93b2c62b0098a039b38569c43b0a7e97b873000ca42d128f27350
18
19 hasht1 sha1:51d27384
20 hasht1 sha256:ae31dfff
21
22 hash2 sha1:51d2738efb4ad8a1e40bed839ab8e116f0a15e47
23 hash2 sha256:ae31dffada88a46fd5f53c7ed5aa25a7a8951f1d5e88456c317c8d5484d263e5
24
25 hasht2 sha1:51d2738e
26 hasht2 sha256:ae31dffa
27 EOF
28
29 cat >expect_initial <<-EOF &&
30 100644 blob $(test_oid hash1) foo
31 EOF
32
33 cat >expect_update <<-EOF &&
34 100644 blob $(test_oid hash2) foo
35 EOF
36
37 echo "$(test_oid val1)" > foo &&
3e5a188f
JH
38 git add foo &&
39 git commit -m "initial" &&
40 git cat-file -p HEAD: > actual &&
41 test_cmp expect_initial actual &&
38ee26b2 42 echo "$(test_oid val2)" > foo &&
3e5a188f
JH
43 git commit -a -m "update" &&
44 git cat-file -p HEAD: > actual &&
45 test_cmp expect_update actual
46'
47
48cat >expect <<EOF
38ee26b2 49index $(test_oid hasht1)..$(test_oid hasht2) 100644
3e5a188f
JH
50EOF
51
52test_expect_success 'diff does not produce ambiguous index line' '
53 git diff HEAD^..HEAD | grep index > actual &&
54 test_cmp expect actual
55'
56
57test_done