Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Need support for git submodule init/update with git URLs #1009

Closed
robrix opened this issue Mar 19, 2010 · 9 comments
Closed

Need support for git submodule init/update with git URLs #1009

robrix opened this issue Mar 19, 2010 · 9 comments

Comments

@robrix
Copy link
Contributor

robrix commented Mar 19, 2010

When trying to make a formula for @nvie’s gitflow (http://github.com/nvie/gitflow), I found that using a git:// url (or head) will git checkout-index before the install step, which means that the requisite git submodule init and update commands can’t be run (since they have to have the .git repo available).

Automatic or formula-specified support for git submodules would prevent this issue while not requiring brew to stop using checkout-index or provide an intermediate step in the Caches dir. Automatic support could be done by checking for the existence of .gitmodules.

It occurs to me that checkout-index will probably not copy the submodule folders, though.

@mxcl
Copy link
Contributor

mxcl commented Mar 19, 2010

Quite easy to fix, just run the submodule init if .gitsubmodules exists. Or is that too simple?

Like you say the export may not work, but we'll have to try it to find out.

Can you provide your gitflow formula so we can test with something that needs it?

@robrix
Copy link
Contributor Author

robrix commented Mar 19, 2010

Running git submodule init && git submodule update if .gitmodules exists should work just fine, I think.

I’m not sure if I’m writing this formula correctly (specifically, if the md5 line needs to be there as is), but here goes:

http://gist.github.com/337875

[EDIT: Apparently one can’t embed gists in comments. Boo.]

@adamv
Copy link
Contributor

adamv commented Mar 19, 2010

Obviously git-flow depends on git, as it is a git tool, but policy is that we don't explicitly depend on source control systems; should we make an exception on this?

@robrix
Copy link
Contributor Author

robrix commented Mar 19, 2010

I don’t think we need to make an exception. It won’t install without git, so presumably the user will get what they asked for.

@cthachuk
Copy link
Contributor

cthachuk commented Apr 7, 2010

I've added a branch 'git-flow' on my fork that seems to address the submodule issue. As robrix points out, checkout-index does not copy the submodule folders. Luckily, we can checkout-index for each submodule by using the 'git submodule foreach' command. git-flow now properly initializes and installs.

http://github.com/cthachuk/homebrew/tree/git-flow

@adamv
Copy link
Contributor

adamv commented Apr 7, 2010

@adamv
Copy link
Contributor

adamv commented Apr 8, 2010

I pushed the commit to fix this, but then testing with a redcar formula I get:
http://gist.github.com/360486

(The git-flow formula worked.)

Maybe an issue with multiple submodules?

@adamv
Copy link
Contributor

adamv commented Apr 9, 2010

Quote prefix for git submodules. Closed by a4dc535

@robrix
Copy link
Contributor Author

robrix commented Apr 23, 2010

Sorry for the long delay on this. Indeed, this is fixed and working beautifully. Thanks!

Sharpie pushed a commit to Sharpie/homebrew that referenced this issue Sep 19, 2011
If submodules exists for a git repo then checkout their index as well
into the appropriate path.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Sharpie pushed a commit to Sharpie/homebrew that referenced this issue Sep 19, 2011
etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 27, 2011
If submodules exists for a git repo then checkout their index as well
into the appropriate path.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 27, 2011
snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012
If submodules exists for a git repo then checkout their index as well
into the appropriate path.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants