git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-svnimport issue with rename+change in the same commit

From
MManu <manu@blairos.org>
Date
Feb 14, 2006, 17:29 UTC
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
Previous: Eduardo Pereira Habkost
Message 2 of 2 in “git-svnimport issue with rename+change in the same commit”
  1. Eduardo Pereira HabkostFeb 14, 2006
  2. ManuFeb 14, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.