]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1010-mktree.sh
hashmap_put takes "struct hashmap_entry *"
[thirdparty/git.git] / t / t1010-mktree.sh
CommitLineData
801cfae8
JH
1#!/bin/sh
2
3test_description='git mktree'
4
5. ./test-lib.sh
6
7test_expect_success setup '
8 for d in a a. a0
9 do
10 mkdir "$d" && echo "$d/one" >"$d/one" &&
11 git add "$d"
12 done &&
1c64e79a
JH
13 echo zero >one &&
14 git update-index --add --info-only one &&
15 git write-tree --missing-ok >tree.missing &&
16 git ls-tree $(cat tree.missing) >top.missing &&
17 git ls-tree -r $(cat tree.missing) >all.missing &&
801cfae8
JH
18 echo one >one &&
19 git add one &&
20 git write-tree >tree &&
21 git ls-tree $(cat tree) >top &&
22 git ls-tree -r $(cat tree) >all &&
23 test_tick &&
24 git commit -q -m one &&
25 H=$(git rev-parse HEAD) &&
26 git update-index --add --cacheinfo 160000 $H sub &&
27 test_tick &&
28 git commit -q -m two &&
29 git rev-parse HEAD^{tree} >tree.withsub &&
30 git ls-tree HEAD >top.withsub &&
31 git ls-tree -r HEAD >all.withsub
32'
33
34test_expect_success 'ls-tree piped to mktree (1)' '
35 git mktree <top >actual &&
36 test_cmp tree actual
37'
38
39test_expect_success 'ls-tree piped to mktree (2)' '
40 git mktree <top.withsub >actual &&
41 test_cmp tree.withsub actual
42'
43
44test_expect_success 'ls-tree output in wrong order given to mktree (1)' '
94221d22 45 perl -e "print reverse <>" <top |
801cfae8
JH
46 git mktree >actual &&
47 test_cmp tree actual
48'
49
50test_expect_success 'ls-tree output in wrong order given to mktree (2)' '
94221d22 51 perl -e "print reverse <>" <top.withsub |
801cfae8
JH
52 git mktree >actual &&
53 test_cmp tree.withsub actual
54'
55
1c64e79a
JH
56test_expect_success 'allow missing object with --missing' '
57 git mktree --missing <top.missing >actual &&
58 test_cmp tree.missing actual
59'
60
53b3c47d
MG
61test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
62 test_must_fail git mktree <all >actual
801cfae8
JH
63'
64
53b3c47d
MG
65test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
66 test_must_fail git mktree <all.withsub >actual
801cfae8
JH
67'
68
69test_done