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 <luke@diamand.org> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Luke Diamand committed Jan 19, 2012 at 09:52 UTC a080558ed77952b2394499531edc324eb2885d67
1 file changed +41
t/t9804-git-p4-label.sh
+41
@@ -65,6 +65,47 @@ test_expect_success 'basic p4 labels' '
65 )
66 '
67
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 +
109 test_expect_success 'kill p4d' '
110 kill_p4d
111 '