views:

230

answers:

1

I just finished converting a Subversion repository to git using

git svn clone--stdlayout --authors-file=ourcommitters.txt svn://svn.internalserver.com

While doing so, I had the git flag 'core.autocrlf' set to 'true' - just in case that matters.

After a long time, the command finished. I cleaned the resulting git repository a bit (deleting unneded branches, creating tags etc.) and now everything looks really nice and works well. The repository is hosted on a Linux box, and cloning that onto other Linux boxes works really well.

However, I noticed one problem: when cloning the repository onto a Windows box, some files appear to be modified when switching branches. For instance, I do this:

git clone svn://our.git.server/foo
git status                           # Everything is clean
git checkout -t origin/maintenance   # Switch to maintenance branch
git status                           # Everything is clean
git checkout master                  # Back to master branch
git status                           # A few files are modified!

When doing a 'git diff', I notice that the modified files seem to differ in nothing but their line endings. When researching this a bit, we noticed that these files had accidentally been checked in using CR-LF line endings (instead of LF line endings) in Subversion, and this bug was converted into our git repository.

Is there any way to fix this issue in our repository (so far it wasn't cloned very often, so some history rewriting would be fine) without doing a 'cleanup commit' or the like? Maybe we can silently rewrite the affected objects somehow?

Alternatively, we could fix this in Subversion - and then issue the 'git svn clone' command above again. This seems to work incrementally (it would just pick up the latest line ending fix commit) but again - it creates a commit. I wonder whether I can get around that.

+1  A: 

It turned out that the easiest way was to fix the faulty files in Subversion, and then clone again using

git svn clone--stdlayout --authors-file=ourcommitters.txt svn://svn.internalserver.com
Frerich Raabe