Some remarks on SubGit

I’ve been evaluating SubGit with a colleague for some time now. It seems to be a decent tool if you have to use Subversion and can’t simply switch to Git completely. Nevertheless, we stumbled on a few (pretty annoying) things:

First, SubGit writes changes to the Git tree right into Subversion. As Subversion doesn’t know things like fast-forwards, this results in funny commits with messages like “trunk:$rev replaced by branch:$rev“. That kinda freaked out some colleagues of mine before we understood what’s really going on[1]. A solution for this is the –no-ff flag when merging. You might just want to set it for the whole repository or even globally:

git config --add merge.ff false # add --global if you want to set it globally

Also, if you have a lot of Maven modules and want to ignore things like .classpath, .projects, target etc, this will result in SubGit trying to burn down your CPU to create a lovely .gitignore[2], for us with ~5500 lines. The solution is quite easy. Edit your $subgit_project_dir/subgit/config and add the following:

[translate]
    ignores = false

This simply tells SubGit to stop translating the Subversion ignores into Git ignores. Now you have to manage the ignores yourself but at least for us it’s worth it ;)

Last but not least: Use the beta of version 3. It’s much more mature than the name suggests and for us it’s also more stable.

[1] http://lists.tmatesoft.com/pipermail/subgit-users/2013-June/000129.html

[2] http://issues.tmatesoft.com/issue/SGT-828

By the way, to get notified about new posts, just enter your email address on the right :)

subversion, git, subgit & Windows

On client-side we’re currently working with subversion, which is a (serious) pain. On top we have Windows7 machines. To deal with the first problem, I used git-svn for quite some time and in combination with Sourcetree it worked quite well. When I came back from my xmas break last week, the subversion structure was changed drastically and git-svn didn’t work anymore. It couldn’t clone the new repository and died after hours of trying with weird error messages. As I wanted to try out subgit (“git mirror for svn”) for quite some time, I didn’t really dive into the git-svn problems but gave subgit a go for evaluation :)

First thing to do is quite obvious: Download and install subgit.
Afterwards you have to configure the repository you want to clone:

subgit configure --svn-url $YOUR_SVN_URL $DESTINATION

I also made some tiny changes to the $DESTINATION/subgit/config file. I enabled httpSpooling (httpSpooling = true) to avoid timeouts and added the following lines at the end of the file:

[translate]
    eols=false

(More about line endings? -> Mind the end of your line)

Next, set your credentials within $DESTINATION/subgit/passwd. Careful: The (unlimited) evaluation version of subgit stores the passwords in plaintext.
Finally, tell subgit to “initialize” the project and start the demon – this might take some time, e.g. for me it took 9h:

subgit install $DESTINATION

Now you’re ready to use whatever git client you like to clone the repository from $DESTINATION and treat it like every other git repos you’re working with. Subgit is dealing with all the annoying svn stuff.
What I still need to test is good the branching and merging “translation” works.

If subgit is running on your dev system, you have to restart the demon by executing the install command again.

A small hint: If you want to use git 2.x on your Windows machine, you won’t find an official download for it yet. The current latest Windows version is 1.9.5. But you can install cygwin with git 2.x and simply add the $CYGWIN_DIR/bin to the Windows $PATH, as Cygwin provides you with a git.exe :P