From: Manu Date: Tue, 14 Feb 2006 17:29:23 GMT Subject: Re: git-svnimport issue with rename+change in the same commit Message-ID: <43F21373.8040400@blairos.org> In-Reply-To: <20060214171233.GC4381@duckman.conectiva> Hi, Eduardo Pereira Habkost wrote: > Hi, > > I've just hit a problem when using git-svnimport to import a big > subversion repository: it doesn't import correctly a commit when the > commit renames (or copies) and modify a file at the same time. I came accross the same problem myself. Here is a patch that seemed to do the trick for me. I tried your script, and it also seems to work. Regards, Emmanuel --- [PATCH] git-svnimport: Correction when a "copy_path" has different contents for src and dest. In my SVN repository, there is a weird log: A /trunk/mydir2 (from /trunk/mydir1:4) R /trunk/mydir2/test.txt (from /trunk/mydir1/test.txt:4) As a result, mydir2/test.txt is different than mydir1/test.txt, but git-svnimport assumes that the content of mydir2/test.txt is the same as mydir1/test.txt. This patch adds a test in copy_path, that makes sure that src and dest have the same content. If not, it uses the content of dest. --- git-svnimport.perl | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) e107ff9a06497a0003036ffafa45fa9dc050ecc4 diff --git a/git-svnimport.perl b/git-svnimport.perl index f17d5a2..a2faa9a 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -409,6 +409,12 @@ sub copy_path($$$$$$$$) { $p = $path . substr($p,length($srcpath)-1); } else { $p = $path; + # Deal with copy and modification + my $f=get_file($newrev,$newbranch,$path); + my ($tmode,$tsha1,$tp)=@$f; + if ($tsha1 ne $sha1) { + $sha1=$tsha1; + } } push(@$new,[$mode,$sha1,$p]); } -- 1.1.GIT