]>
Commit | Line | Data |
---|---|---|
f0a24aa5 SP |
1 | #!/bin/sh |
2 | ||
3604e7c5 | 3 | test_description='git pack-object --include-tag' |
f0a24aa5 SP |
4 | . ./test-lib.sh |
5 | ||
0469cb96 | 6 | TRASH=$(pwd) |
f0a24aa5 SP |
7 | |
8 | test_expect_success setup ' | |
9 | echo c >d && | |
10 | git update-index --add d && | |
0469cb96 EP |
11 | tree=$(git write-tree) && |
12 | commit=$(git commit-tree $tree </dev/null) && | |
f0a24aa5 SP |
13 | echo "object $commit" >sig && |
14 | echo "type commit" >>sig && | |
15 | echo "tag mytag" >>sig && | |
16 | echo "tagger $(git var GIT_COMMITTER_IDENT)" >>sig && | |
17 | echo >>sig && | |
18 | echo "our test tag" >>sig && | |
0469cb96 | 19 | tag=$(git mktag <sig) && |
f0a24aa5 SP |
20 | rm d sig && |
21 | git update-ref refs/tags/mytag $tag && { | |
22 | echo $tree && | |
23 | echo $commit && | |
24 | git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/" | |
25 | } >obj-list | |
26 | ' | |
27 | ||
f0a24aa5 | 28 | test_expect_success 'pack without --include-tag' ' |
ab517835 | 29 | packname=$(git pack-objects \ |
f0a24aa5 | 30 | --window=0 \ |
ab517835 | 31 | test-no-include <obj-list) |
f0a24aa5 SP |
32 | ' |
33 | ||
34 | test_expect_success 'unpack objects' ' | |
1962d9fb | 35 | rm -rf clone.git && |
948a7fd2 | 36 | git init clone.git && |
ab517835 | 37 | git -C clone.git unpack-objects <test-no-include-${packname}.pack |
f0a24aa5 SP |
38 | ' |
39 | ||
40 | test_expect_success 'check unpacked result (have commit, no tag)' ' | |
41 | git rev-list --objects $commit >list.expect && | |
948a7fd2 JK |
42 | test_must_fail git -C clone.git cat-file -e $tag && |
43 | git -C clone.git rev-list --objects $commit >list.actual && | |
3af82863 | 44 | test_cmp list.expect list.actual |
f0a24aa5 SP |
45 | ' |
46 | ||
f0a24aa5 | 47 | test_expect_success 'pack with --include-tag' ' |
ab517835 | 48 | packname=$(git pack-objects \ |
f0a24aa5 SP |
49 | --window=0 \ |
50 | --include-tag \ | |
ab517835 | 51 | test-include <obj-list) |
f0a24aa5 SP |
52 | ' |
53 | ||
54 | test_expect_success 'unpack objects' ' | |
1962d9fb | 55 | rm -rf clone.git && |
948a7fd2 | 56 | git init clone.git && |
ab517835 | 57 | git -C clone.git unpack-objects <test-include-${packname}.pack |
f0a24aa5 SP |
58 | ' |
59 | ||
60 | test_expect_success 'check unpacked result (have commit, have tag)' ' | |
61 | git rev-list --objects mytag >list.expect && | |
948a7fd2 | 62 | git -C clone.git rev-list --objects $tag >list.actual && |
3af82863 | 63 | test_cmp list.expect list.actual |
f0a24aa5 SP |
64 | ' |
65 | ||
b773ddea JK |
66 | # A tag of a tag, where the "inner" tag is not otherwise |
67 | # reachable, and a full peel points to a commit reachable from HEAD. | |
68 | test_expect_success 'create hidden inner tag' ' | |
69 | test_commit commit && | |
70 | git tag -m inner inner HEAD && | |
71 | git tag -m outer outer inner && | |
72 | git tag -d inner | |
73 | ' | |
74 | ||
75 | test_expect_success 'pack explicit outer tag' ' | |
76 | packname=$( | |
77 | { | |
78 | echo HEAD && | |
79 | echo outer | |
80 | } | | |
81 | git pack-objects --revs test-hidden-explicit | |
82 | ) | |
83 | ' | |
84 | ||
85 | test_expect_success 'unpack objects' ' | |
86 | rm -rf clone.git && | |
87 | git init clone.git && | |
88 | git -C clone.git unpack-objects <test-hidden-explicit-${packname}.pack | |
89 | ' | |
90 | ||
91 | test_expect_success 'check unpacked result (have all objects)' ' | |
92 | git -C clone.git rev-list --objects $(git rev-parse outer HEAD) | |
93 | ' | |
94 | ||
95 | test_expect_success 'pack implied outer tag' ' | |
96 | packname=$( | |
97 | echo HEAD | | |
98 | git pack-objects --revs --include-tag test-hidden-implied | |
99 | ) | |
100 | ' | |
101 | ||
102 | test_expect_success 'unpack objects' ' | |
103 | rm -rf clone.git && | |
104 | git init clone.git && | |
105 | git -C clone.git unpack-objects <test-hidden-implied-${packname}.pack | |
106 | ' | |
107 | ||
108 | test_expect_success 'check unpacked result (have all objects)' ' | |
109 | git -C clone.git rev-list --objects $(git rev-parse outer HEAD) | |
110 | ' | |
111 | ||
112 | test_expect_success 'single-branch clone can transfer tag' ' | |
113 | rm -rf clone.git && | |
114 | git clone --no-local --single-branch -b master . clone.git && | |
115 | git -C clone.git fsck | |
116 | ' | |
117 | ||
f0a24aa5 | 118 | test_done |