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

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

From
EHEduardo Pereira Habkost <ehabkost@mandriva.com>
Date
Feb 14, 2006, 17:12 UTC
Message-ID
<20060214171233.GC4381@duckman.conectiva>
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.

At the bottom of this message, there is a script that reproduces the bug.
The result of the final 'diff' command on the script is:

diff -u --exclude .git --exclude .svn checkout/universe.py git/universe.py --- checkout/universe.py 2006-02-14 14:55:37.000000000 -0200 +++ git/universe.py 2006-02-14 14:55:38.000000000 -0200

@@ -1 +1 @@
-print "Hello, universe!"
+print "Hello, world!"

git-svnadmin is just taking the original version of the file when
the commit has a 'file copy', even if this copy was modified before
the commit.

However I can't see a way to fix this problem without making the script
ignore completely the the "copied from" information from the svn commits
(and always fetching the resulting files from the repository). It seems
that subversion doesn't tell us if the copied file was changed (or this
information is hidden somewhere else).
-- 
Eduardo


#!/bin/sh
set -e

mkdir repos
svnadmin create $PWD/repos
repos=file://$PWD/repos
svn mkdir $repos/trunk -m 'creating trunk'
svn co file://$PWD/repos/trunk checkout
cd checkout
cat >hello.py <<EOF
print "Hello, world!"
EOF
svn add hello.py
svn commit -m 'adding hello.py'
svn mv hello.py world.py
svn commit -m 'renaming to world.py'
svn mv world.py universe.py
sed -i -e 's/world/universe/' universe.py
svn commit -m 'universe, now'
cd ..
mkdir git
cd git
git svnimport $repos
cd ..
diff -u --exclude .git --exclude .svn checkout git # will report differences
Next: Manu
Message 1 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.