16

In our git-svn managed project, we have 3 upstream projects that are all kept in native git repositories on GitHub. Since the source code of those upstream projects is under our control and changes frequently, our current solution, namely re-deploying the build artifacts to the super-project everytime we change something is quite cumbersome.

What I'd like to have is this:

parent project (git-svn):
    --> submodule 1 (git)
    --> submodule 2 (git)
    --> submodule 3 (git)

That way, the source code for submodules 1-3 is compiled along with the sources for the super project, but I can push changes to submodules separately.

The question is: what happens when I git svn dcommit on the parent project? Does this even work?

UPDATE Hm, I just set up a simple project structure, trying to resemble this scenario, and I receive this error message when trying to dcommit on the superproject:

a0301b11f3544a1e71067ff270eded65e4c8afbd doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4775
Failed to read object a0301b11f3544a1e71067ff270eded65e4c8afbd at /opt/local/libexec/git-core/git-svn line 574

Any ideas/suggestions?

mxk
  • 43,056
  • 28
  • 105
  • 132
  • In our world, we use Hudson to build and deploy submodules to a local repository such as Artifactory. Maven is configured to grab SNAPSHOT version so they grab a fresh deploy every day, or whenever we build with -U. Hudson can be configured to send out an email for a new deploy. – Travis Stevens Apr 06 '11 at 22:57
  • Update re bounty looking for up-to-date answer/workaround. I think an answer to this question is what I'm look for: [Is git svn compatible with git subtree?](http://stackoverflow.com/questions/13447705/is-git-svn-compatible-with-git-subtree) – Sam Hasler Mar 21 '13 at 11:53
  • possible duplicate of [git-svn - #object# doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4706](http://stackoverflow.com/questions/2771033/git-svn-object-doesnt-exist-in-the-repository-at-opt-local-libexec-git-cor) – Kristopher Johnson May 23 '13 at 02:06

2 Answers2

10

You can't do this, git submodules can't be pushed upstream into a svn repository via git-svn, it doesn't support this.

cbz
  • 1,696
  • 1
  • 15
  • 19
  • 2
    Yeah, we meanwhile moved our entire source code to a paid GitHub account. Problem solved. – mxk Feb 15 '11 at 19:58
5

git-svn doesn't allow this, but if you have an access to your SVN repository server, you can install SubGit into it. It will created a linked Git repository for you, such that any push to it will be automatically translated to SVN revision and vice versa. After that you can add submodules to the resulting Git repository and work with the SVN repository using pure Git interface. These Git submodules will not be translated to SVN.

The translation is concurrent-safe and rather transparent (svn:ignores will be translated to Git ignores, EOLs to .gitattributes, tags to tags and so on).

Dmitry Pavlenko
  • 8,530
  • 3
  • 30
  • 38