@@ -25,58 +25,94 @@ test_expect_success setup '
25
25
} >obj-list
26
26
'
27
27
28
- rm -rf clone.git
29
28
test_expect_success ' pack without --include-tag' '
30
- packname_1 =$(git pack-objects \
29
+ packname =$(git pack-objects \
31
30
--window=0 \
32
- test-1 <obj-list)
31
+ test-no-include <obj-list)
33
32
'
34
33
35
34
test_expect_success ' unpack objects' '
36
- (
37
- GIT_DIR=clone.git &&
38
- export GIT_DIR &&
39
- git init &&
40
- git unpack-objects -n <test-1-${packname_1}.pack &&
41
- git unpack-objects <test-1-${packname_1}.pack
42
- )
35
+ rm -rf clone.git &&
36
+ git init clone.git &&
37
+ git -C clone.git unpack-objects <test-no-include-${packname}.pack
43
38
'
44
39
45
40
test_expect_success ' check unpacked result (have commit, no tag)' '
46
41
git rev-list --objects $commit >list.expect &&
47
- (
48
- test_must_fail env GIT_DIR=clone.git git cat-file -e $tag &&
49
- git rev-list --objects $commit
50
- ) >list.actual &&
42
+ test_must_fail git -C clone.git cat-file -e $tag &&
43
+ git -C clone.git rev-list --objects $commit >list.actual &&
51
44
test_cmp list.expect list.actual
52
45
'
53
46
54
- rm -rf clone.git
55
47
test_expect_success ' pack with --include-tag' '
56
- packname_1 =$(git pack-objects \
48
+ packname =$(git pack-objects \
57
49
--window=0 \
58
50
--include-tag \
59
- test-2 <obj-list)
51
+ test-include <obj-list)
60
52
'
61
53
62
54
test_expect_success ' unpack objects' '
63
- (
64
- GIT_DIR=clone.git &&
65
- export GIT_DIR &&
66
- git init &&
67
- git unpack-objects -n <test-2-${packname_1}.pack &&
68
- git unpack-objects <test-2-${packname_1}.pack
69
- )
55
+ rm -rf clone.git &&
56
+ git init clone.git &&
57
+ git -C clone.git unpack-objects <test-include-${packname}.pack
70
58
'
71
59
72
60
test_expect_success ' check unpacked result (have commit, have tag)' '
73
61
git rev-list --objects mytag >list.expect &&
74
- (
75
- GIT_DIR=clone.git &&
76
- export GIT_DIR &&
77
- git rev-list --objects $tag
78
- ) >list.actual &&
62
+ git -C clone.git rev-list --objects $tag >list.actual &&
79
63
test_cmp list.expect list.actual
80
64
'
81
65
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
+
82
118
test_done
0 commit comments