@matheusbsbs / matheus-bagliano / commits / 25e0ca5dd6
Fork 0

Add new fast-export testcases

The testcases test the new --tag-of-filtered-object option, the output when limiting what to export by path, and test behavior when no exact-ref revision is included (e.g. master~8 present on command line but not master). Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jun 25, 2009 at 22:48 UTC 25e0ca5dd61f8a4625393fa1b71e1f88c9fab754
1 file changed +88
t/t9301-fast-export.sh
+88
@@ -262,6 +262,94 @@ test_expect_success 'cope with tagger-less tags' '
262
263 '
264
265 +test_expect_success 'setup for limiting exports by PATH' '
266 + mkdir limit-by-paths &&
267 + cd limit-by-paths &&
268 + git init &&
269 + echo hi > there &&
270 + git add there &&
271 + git commit -m "First file" &&
272 + echo foo > bar &&
273 + git add bar &&
274 + git commit -m "Second file" &&
275 + git tag -a -m msg mytag &&
276 + echo morefoo >> bar &&
277 + git add bar &&
278 + git commit -m "Change to second file" &&
279 + cd ..
280 +'
281 +
282 +cat > limit-by-paths/expected << EOF
283 +blob
284 +mark :1
285 +data 3
286 +hi
287 +
288 +reset refs/tags/mytag
289 +commit refs/tags/mytag
290 +mark :2
291 +author A U Thor <author@example.com> 1112912713 -0700
292 +committer C O Mitter <committer@example.com> 1112912713 -0700
293 +data 11
294 +First file
295 +M 100644 :1 there
296 +
297 +EOF
298 +
299 +test_expect_success 'dropping tag of filtered out object' '
300 + cd limit-by-paths &&
301 + git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
302 + test_cmp output expected &&
303 + cd ..
304 +'
305 +
306 +cat >> limit-by-paths/expected << EOF
307 +tag mytag
308 +from :2
309 +tagger C O Mitter <committer@example.com> 1112912713 -0700
310 +data 4
311 +msg
312 +
313 +EOF
314 +
315 +test_expect_success 'rewriting tag of filtered out object' '
316 + cd limit-by-paths &&
317 + git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
318 + test_cmp output expected &&
319 + cd ..
320 +'
321 +
322 +cat > limit-by-paths/expected << EOF
323 +blob
324 +mark :1
325 +data 4
326 +foo
327 +
328 +blob
329 +mark :2
330 +data 3
331 +hi
332 +
333 +reset refs/heads/master
334 +commit refs/heads/master
335 +mark :3
336 +author A U Thor <author@example.com> 1112912713 -0700
337 +committer C O Mitter <committer@example.com> 1112912713 -0700
338 +data 12
339 +Second file
340 +M 100644 :1 bar
341 +M 100644 :2 there
342 +
343 +EOF
344 +
345 +test_expect_failure 'no exact-ref revisions included' '
346 + cd limit-by-paths &&
347 + git fast-export master~2..master~1 > output &&
348 + test_cmp output expected &&
349 + cd ..
350 +'
351 +
352 +
353 test_expect_success 'set-up a few more tags for tag export tests' '
354 git checkout -f master &&
355 HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&