git-svn: Demonstrate a bug with root commits in mergeinfo ranges

If a svn:mergeinfo range starts at a commit that was converted as a git root commit (e.g., r1 or a branch that was created out of thin air), then there is an error when git-svn tries to run git rev-list "$bottom_commit^..$top_commit" because $bottom_commit (the git commit corresponding to r1) has no parent. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Acked-by: Eric Wong <normalperson@yhbt.net>

Michael Haggerty committed Jun 18, 2011 at 08:47 UTC 555bdc66eab0178d43c509ec53c1d97303675f90
1 file changed +33
t/t9159-git-svn-no-parent-mergeinfo.sh new
+33
@@ -0,0 +1,33 @@
1 +#!/bin/sh
2 +test_description='git svn handling of root commits in merge ranges'
3 +. ./lib-git-svn.sh
4 +
5 +test_expect_failure 'test handling of root commits in merge ranges' '
6 + mkdir -p init/trunk init/branches init/tags &&
7 + echo "r1" > init/trunk/file.txt &&
8 + svn_cmd import -m "initial import" init "$svnrepo" &&
9 + svn_cmd co "$svnrepo" tmp &&
10 + (
11 + cd tmp &&
12 + echo "r2" > trunk/file.txt &&
13 + svn_cmd commit -m "Modify file.txt on trunk" &&
14 + svn_cmd cp trunk@1 branches/a &&
15 + svn_cmd commit -m "Create branch a from trunk r1" &&
16 + svn_cmd propset svn:mergeinfo /trunk:1-2 branches/a &&
17 + svn_cmd commit -m "Fake merge of trunk r2 into branch a" &&
18 + mkdir branches/b &&
19 + echo "r5" > branches/b/file2.txt &&
20 + svn_cmd add branches/b &&
21 + svn_cmd commit -m "Create branch b from thin air" &&
22 + echo "r6" > branches/b/file2.txt &&
23 + svn_cmd commit -m "Modify file2.txt on branch b" &&
24 + svn_cmd cp branches/b@5 branches/c &&
25 + svn_cmd commit -m "Create branch c from branch b r5" &&
26 + svn_cmd propset svn:mergeinfo /branches/b:5-6 branches/c &&
27 + svn_cmd commit -m "Fake merge of branch b r6 into branch c"
28 + ) &&
29 + git svn init -s "$svnrepo" &&
30 + git svn fetch
31 + '
32 +
33 +test_done