Background
Our team is working with a codebase stored in CVS, which is managed by the client.
There is no possible way to convince the client to switch to Git in any forseeable future.
Therefore, to be able to use the obvious advantages of git, we want to make a git copy of the CVS repo, use it and keep both repos synchronized.
First attempt
Our first attempt to resolve the problem was to:
- checkout CVS repo
- git initand- git commitin the same directory to import entire tree at once
- for each new feature, we make a git branch, do the stuff, use git-cvsexport, and usecvsto commit the feature
- every half an hour we run (from cron)cvs update,git add .andgit committo transfer new stuff that apeared in cvs to git
This approach has drawbacks - the main problem is that history on CVS and git are not alike.
Planned changes
So we plan to switch to git cvsimport in a manner described here, more or less.
Issue
Still, we can image such a scenario:
- we have commit Acon cvs andAg(made bygit cvsimport) on master branch on git, which are alike
- we make a feature branch, on which we make commit Xg
- we use git cvsexportcommitandcvs committo make commitXcon cvs
- cvs parses $Id $sections in commited file, and makes actual changes to the file
- we run git cvsimportto import changes from cvs. This would transferXcto git's master branch and make a commitXg'
Question
How do we tell git that commits Xg and Xg' are actually the same thing?
According to this post, there seems to be no way to do that, as content is a crucial part of commit's id, and git only uses ids to identify the commits.
Workarounds
To mitigate the issue, I thought of a following solutions:
- Instead of issuing git cvsimport, we could usecvspsto make patches, and skip commits, which were created by our team, which we would recognize by author's email. This would not create commitXg', so we'd have to take extra care of appropriate branches' merging.
- We would never merge feature branches into master, so we'd never have conflicts. Seems easy, But i guess that would make feature branches a bit less useful, and still, we'd have no clear git history.
Bonus question
We assumed that we would run git cvsexportcommit from feature branch. Would it be better (meaning easier to maintain) to merge the feature to master branch first, and them issue git cvsexportcommit? Would it make any real difference?
Or perhaps, our entire idea is wrong, and we should consider using an alternate solution?
Thank you in advance.
 
     
    