Skip to content

Commit eceafff

Browse files
luked99gitster
authored andcommitted
git-p4: add tests for non-numeric revision range
Test that git-p4 can handle a sync with a non-numeric revision range (e.g. a date). Signed-off-by: Luke Diamand <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ba9e2c commit eceafff

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

t/t9800-git-p4-basic.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,44 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
131131
)
132132
'
133133

134+
revision_ranges="2000/01/01,#head \
135+
1,2080/01/01 \
136+
2000/01/01,2080/01/01 \
137+
2000/01/01,1000 \
138+
1,1000"
139+
140+
test_expect_success 'clone using non-numeric revision ranges' '
141+
test_when_finished cleanup_git &&
142+
for r in $revision_ranges
143+
do
144+
rm -fr "$git" &&
145+
test ! -d "$git" &&
146+
git p4 clone --dest="$git" //depot@$r &&
147+
(
148+
cd "$git" &&
149+
git ls-files >lines &&
150+
test_line_count = 6 lines
151+
)
152+
done
153+
'
154+
155+
test_expect_success 'clone with date range, excluding some changes' '
156+
test_when_finished cleanup_git &&
157+
before=$(date +%Y/%m/%d:%H:%M:%S) &&
158+
sleep 2 &&
159+
(
160+
cd "$cli" &&
161+
:>date_range_test &&
162+
p4 add date_range_test &&
163+
p4 submit -d "Adding file"
164+
) &&
165+
git p4 clone --dest="$git" //depot@1,$before &&
166+
(
167+
cd "$git" &&
168+
test_path_is_missing date_range_test
169+
)
170+
'
171+
134172
test_expect_success 'exit when p4 fails to produce marshaled output' '
135173
mkdir badp4dir &&
136174
test_when_finished "rm badp4dir/p4 && rmdir badp4dir" &&

0 commit comments

Comments
 (0)