0

So I have my main repository and as a backend I want to add submodules which are repositories I don't have write access to. However I want to be able to keep on pulling from the mainstream.

I want to add a plugin to one of those backends that reside as a submodule, and to do that the plugin code must be placed inside the backends/foo/src/ directory of my submodule. At the same time I want to keep my backends/foo/src/plugin as a part of my main repo.

Is there a way to do that with github ?

2
  • Not really sure what you're asking… So backends/foo/ would be a submodule, and src/foo-plugin.c, which references ../backends/foo/foo.h, would be in your repo? Where do you think the problem is? Commented Mar 24, 2018 at 18:48
  • I edited my post a bit, maybe now its more clear. I understand its not easy, maybe it does not even make sense what I want to do and there is a better way. Basically I want to add extra code inside the submodule, however that extra code should not be treated as part of the submodule. And if it is possible I would like to make it part of my main repo. So Would be something like MainRepo(Submodule(PartOfMainRepo)). Commented Mar 24, 2018 at 18:56

1 Answer 1

1

No. Once you make backends/foo a submodule, you basically hand over control of that directory to the other repository.

You could use some build system magic to copy files around, or fork the remote repo, add your plugin, then use that as the submodule instead.

However, the best thing to do would probably be to take a close look at the submodule and figure out a way to build plugins out of their source tree. If you have to hack their build system to be able to do it the odds are good that they would accept a patch.

Sign up to request clarification or add additional context in comments.

2 Comments

Your last point was my first idea. I asked the developers but they told me that it is not that easy, I don't exactly know why. They use waf to build the project and I don't have time to learn how to make waf do the trick ( I wish I had the time to learn that..). I will probably go for the fork idea. Will I be able to merge my fork with the main repository (since I should not add conflicts) every now and then?
Yeah, it's pretty easy; just add a second remote (I usually call it "upstream", so git remote add upstream https://github.com/foo/bar.git), then you can just do git pull upstream to grab any changes. You can even skip the second remote and just do git pull https://github.com/foo/bar.git.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.