1

I'm trying to migrate svn project into git, and I don't manage to migrate the whole history of files that have been copied inside my svn repository.

I managed to reproduce the error I have with the following steps :

# create a test repository
svnadmin create test

# checkout the project and create a file
svn co svn://localhost/test
cd test
touch original.txt
svn add original.txt
svn commit -m "add original.txt"

# add an item in the file's history
echo "change 1" >> original.txt
svn commit -m "change 1 in original.txt"

# create a sub folder
mkdir sub
svn add sub
svn commit -m "add sub"

# cp original to sub
svn copy svn://localhost/test/original.txt svn://localhost/test/sub/

# migrate to git
cd ..
git svn clone svn://localhost/test/sub test-sub

Now if I get the git history of original.txt I only see :

> git log
author: (no author) <(no author)@1505a309-be06-4361-bd01-fbca4a25f6d8>
copy original.txt

Whereas if I get the svn history of sub/original.txt I see :

> svn log
r4 | (pas d'auteur)
copy original.txt

r2 | (pas d'auteur)
change 1 in original.txt

r1 | (pas d'auteur)
add original.txt

How can I migrate this folder to git keeping the same history I see in svn?

Guillaume Delafosse
  • 222
  • 1
  • 3
  • 14

1 Answers1

0

Git does not really track file renames or copies. It just tries to recognize whether the file was copied or renamed using heuristic-based approach.

Since there is no true rename tracking in Git, there is a chance of losing file history after renaming or copying it. My guess that you've encountered this particular scenario.

bahrep
  • 29,961
  • 12
  • 103
  • 150