Skip to content

Commit a080558

Browse files
luked99gitster
authored andcommitted
git-p4: label import fails with multiple labels at the same changelist
git-p4 has an array of changelists with one label per changelist. But you can have multiple labels on a single changelist and so this code fails. Add a test case demonstrating the problem. Signed-off-by: Luke Diamand <[email protected]> Acked-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4139ecc commit a080558

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

t/t9804-git-p4-label.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,47 @@ test_expect_success 'basic p4 labels' '
6565
)
6666
'
6767

68+
# Test some label corner cases:
69+
#
70+
# - two tags on the same file; both should be available
71+
# - a tag that is only on one file; this kind of tag
72+
# cannot be imported (at least not easily).
73+
74+
test_expect_failure 'two labels on the same changelist' '
75+
test_when_finished cleanup_git &&
76+
(
77+
cd "$cli" &&
78+
mkdir -p main &&
79+
80+
p4 edit main/f1 main/f2 &&
81+
echo "hello world" >main/f1 &&
82+
echo "not in the tag" >main/f2 &&
83+
p4 submit -d "main/f[12]: testing two labels" &&
84+
85+
p4 tag -l tag_f1_1 main/... &&
86+
p4 tag -l tag_f1_2 main/... &&
87+
88+
p4 labels ... &&
89+
90+
"$GITP4" clone --dest="$git" --detect-labels //depot@all &&
91+
cd "$git" &&
92+
93+
git tag | grep tag_f1 &&
94+
git tag | grep -q tag_f1_1 &&
95+
git tag | grep -q tag_f1_2 &&
96+
97+
cd main &&
98+
99+
git checkout tag_tag_f1_1 &&
100+
ls &&
101+
test -f f1 &&
102+
103+
git checkout tag_tag_f1_2 &&
104+
ls &&
105+
test -f f1
106+
)
107+
'
108+
68109
test_expect_success 'kill p4d' '
69110
kill_p4d
70111
'

0 commit comments

Comments
 (0)