Blog entry "Migrating from CVS to Git" on codebrane.com

Michael Haggerty <[email protected]> Mon, 25 Jun 2012 09:36:33 +0200
Newsgroups gmane.comp.version-control.subversion.cvs2svn.user
Message-ID <[email protected]>
[I am sending a CC of this email to the cvs2svn mailing list.]

Hello,

I have a comment about your blog entry about cvs2git [1], which was 
mentioned by a user on the cvs2svn mailing list [2].  Your blog post 
recommends the following conversion steps:

1.  mkdir guanxi-sp-engine
2.  cd guanxi-sp-engine
3.  cp -r ~/dev/Guanxi/Engine/* .
4.  # Remove all the CVS directories and IDEA files
5.  git init
6.  git add .
7.  cd guanxi-sp-engine
8.  cat ../cvs2svn-trunk/output/guanxi-sp-engine-blob.dat /
         ../cvs2svn-trunk/output/guanxi-sp-engine-dump.dat |
         git fast-import

It is very strange that you copy the project files into the new git 
repository working tree before the conversion (in steps 3 and 4).  I 
think that the reason for your suggestion is that you found that without 
those steps there are no files in the git working tree after the 
conversion.  This is indeed confusing, but there is a simpler and better 
solution:

1.  mkdir guanxi-sp-engine
2.  cd guanxi-sp-engine
3.  git init
4.  cat ../cvs2svn-trunk/output/guanxi-sp-engine-blob.dat /
         ../cvs2svn-trunk/output/guanxi-sp-engine-dump.dat |
         git fast-import
5.  git checkout

Let me explain the reason for the problem and how this solution works.

For efficiency reasons, "git fast-import" only inserts the history from 
the dumpfile into the git history without updating the working tree. 
This approach greatly increases its speed.

So, when "git fast-import" is done, the whole CVS history has been 
converted into git history, and the current git HEAD is set to master, 
which has the same contents as the most recent HEAD revision in CVS. 
However, the files corresponding to that revision are not checked out. 
In fact, if you type "git status", it will look like all of the files 
have been deleted.  You can fix this situation by checking out the 
"master" version of the files into the working tree by typing "git 
checkout".

Your method, by contrast, populates the git working tree using files 
taken from a CVS working copy.  This might work, but it is more 
complicated and might fail if the contents of the CVS checkout are not 
identical to the contents of the git "master" revision.  For example, if 
the version-controlled files contain CVS keywords (like $Revision$), 
these may be expanded differently by CVS and in the git history.  The 
result would be that after your conversion it would appear that all of 
the files containing keywords had been edited and staged for commit.

I understand that the cvs2git documentation is not clear about this 
topic, and that your blog post was attempting to fill the gap.  I will 
try to improve the cvs2git documentation to make this point clearer. 
Perhaps you could also edit your blog post to show the method that I 
have suggested.

Yours,
Michael
the cvs2svn/cvs2git maintainer

[1] http://codebrane.com/blog/?p=1499
[2] 
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1670&dsMessageId=2972634

-- 
Michael Haggerty
[email protected]
http://softwareswirl.blogspot.com/

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1670&dsMessageId=2973035

To unsubscribe from this discussion, e-mail: [[email protected]].