Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any problems if using a shared repository between SVN and Git, without git-svn?

Tags:

git

svn

gerrit

Background

In our distributed development teams, we have a centralized SVN repository placed remotely which is used for multiple teams committing there source code. In order to improve local performance, we have decided to use Gerrit (certainly Git instead of SVN) for our code review process, therefore we're setting a Git's master as a "HUB" interoperating with remote SVN repository.

Problem

Typically, the workaround to this problem is git-svn. However, the branch cloned via git-svn has a different folder structure rather than traditional ".git", which can NOT be recognized by Gerrit.

Workaround at present

So we adopt a means looking a bit naive..

  1. Check out remote SVN repository.
  2. At exactly the same directory as SVN working copy, git clone the counterpart git repository. So in this directory there's also a ".git" besides ".svn".

    $ svn co http://remote.svn.repository/some_project

    $ cd some_project

    $ git clone --no-checkout git_reop ./tmp

    $ mv ./tmp/.git ./ # Move .git directory to SVN working copy.

    $ rm -rf ./tmp

    $ git reset --hard HEAD # This is tricky to tell git I want to use this directory as unstaged.

Question

Are there any problems if using a shared repository between SVN and Git, only by pull the Git repository into the same directory as SVN working copy without git-svn?

like image 681
kai liu Avatar asked Oct 21 '22 11:10

kai liu


1 Answers

No real "problem" in that both system can pretty much ignore one another.
(Except git needs to ignore any .svn/ directory, or the unique .svn/ folder, if you are using the latest SVN 1.8)

But your git repo must have gotten all the latest changes of http://remote.svn.repository/some_project before being cloned within that repo (in order to be used by gerrit).
And you can't retain author and dates with git-svn, I don't think a manual sync could either, which means your code review system (gerrit) might not be as efficient in those condition (i.e. reviewing changes without knowing the author).

like image 65
VonC Avatar answered Oct 29 '22 20:10

VonC