Git Submodule Recursive

345 views
Skip to first unread message

thepixel...@googlemail.com

unread,
Jun 8, 2010, 8:05:20 AM6/8/10
to Capistrano
Hi there,

Capistrano should be using the "--recursive" argument on "git
submodule update" to update any nested submodules. I have a few
scenarios where submodules contain other submodules (usually vendor
code).

I can create a ticket on lighthouse and create the patch if need be.

Documentation: http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html
Related lines of code:
- http://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy/scm/git.rb#L155
- http://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy/scm/git.rb#L194

Kind Regards,
-Mathew Davies.

Lee Hambley

unread,
Jun 8, 2010, 8:16:12 AM6/8/10
to capis...@googlegroups.com
Matthew,

I need to make this a bigger patch to allow people to set their git options, as the recursive thing isn't required for everyone – although it does make sense; happy to work with you on this, or take a patch - your call.

- Lee


--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

thepixel...@googlemail.com

unread,
Jun 8, 2010, 8:30:11 AM6/8/10
to Capistrano
Not being a ruby programmer I thought it would be as easy as appending
"--recursive" to the command. I'm out of my depth, so I'll have to let
someone more qualified do the work (happy to learn how it's done
though).

-Mathew

On Jun 8, 1:16 pm, Lee Hambley <lee.hamb...@gmail.com> wrote:
> Matthew,
>
> I need to make this a bigger patch to allow people to set their git options,
> as the recursive thing isn't required for everyone – although it does make
> sense; happy to work with you on this, or take a patch - your call.
>
> - Lee
>
> On 8 June 2010 14:05, thepixeldevelo...@googlemail.com <
>
>
>
> thepixeldevelo...@googlemail.com> wrote:
> > Hi there,
>
> > Capistrano should be using the "--recursive" argument on "git
> > submodule update" to update any nested submodules. I have a few
> > scenarios where submodules contain other submodules (usually vendor
> > code).
>
> > I can create a ticket on lighthouse and create the patch if need be.
>
> > Documentation:
> >http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html
> > Related lines of code:
> > -
> >http://github.com/capistrano/capistrano/blob/master/lib/capistrano/re...
> > -
> >http://github.com/capistrano/capistrano/blob/master/lib/capistrano/re...
>
> > Kind Regards,
> > -Mathew Davies.
>
> > --
> > * You received this message because you are subscribed to the Google Groups
> > "Capistrano" group.
> > * To post to this group, send email to capis...@googlegroups.com
> > * To unsubscribe from this group, send email to
> > capistrano+...@googlegroups.com<capistrano%2Bunsubscribe@googlegrou ps.com>For more options, visit this group at
> >http://groups.google.com/group/capistrano?hl=en

Lee Hambley

unread,
Jun 8, 2010, 9:26:52 AM6/8/10
to capis...@googlegroups.com
Mathew,

Sure that works - but a nicer solution would be to allow configurable git options via the standard config interface - I might work on that a little today and see what come up with.

- Lee

* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

Rafael G.

unread,
Jun 8, 2010, 3:06:35 PM6/8/10
to capis...@googlegroups.com
Recently I have a problem with Git Submodule Recursive and I had to use a plugin to solve this problem.

I think that this solution(add --recursive option as default) if it don't produce any� gotcha/error/... it could be a default. Anyway a path to let add options freely is welcome :)

Regards

El 08/06/10 09:26, Lee Hambley escribi�:
Mathew,

Sure that works - but a nicer solution would be to allow configurable git options via the standard config interface - I might work on that a little today and see what come up with.

- Lee

Not being a ruby programmer I thought it would be as easy as appending
"--recursive" to the command. I'm out of my depth, so I'll have to let
someone more qualified do the work (happy to learn how it's done
though).

-Mathew

On Jun 8, 1:16�pm, Lee Hambley <lee.hamb...@gmail.com> wrote:
> Matthew,
>
> I need to make this a bigger patch to allow people to set their git options,
> as the recursive thing isn't required for everyone � although it does make


-- 
Rafa

thepixel...@googlemail.com

unread,
Jul 6, 2010, 9:39:40 PM7/6/10
to Capistrano
Just to let you guys know. I'm working on a solution. A new
configuration option will be used :git_recursive_submodules

I found space for a bit of code optimization too. Instead of these
commands

execute << "#{git} submodule #{verbose} init"
execute << "#{git} submodule #{verbose} sync"
execute << "#{git} submodule #{verbose} update #{submodule_recursive}"

I found out you can pass the --recursive flag to git clone, although
this is only if you have submodules and recursion enabled. I see no
reason why it should be a configurable option. Any cons to this?
Here's the description for the flag:

After the clone is created, initialize all submodules within, using
their default settings. This is equivalent to running git submodule
update --init --recursive immediately after the clone is finished.
This option is ignored if the cloned repository does not have a
worktree/checkout (i.e. if any of --no-checkout/-n, --bare, or --
mirror is given)

On Jun 8, 8:06 pm, "Rafael G." <r...@aspgems.com> wrote:
> Recently I have a problem with Git Submodule Recursive and I had to use
> a plugin to solve this problem.
>
> I think that this solution(add --recursive option as default) if it
> don't produce any  gotcha/error/... it could be a default. Anyway a path
> to let add options freely is welcome :)
>
> Regards
>
> El 08/06/10 09:26, Lee Hambley escribi�:
>
>
>
>
>
> > Mathew,
>
> > Sure that works - but a nicer solution would be to allow configurable
> > git options via the standard config interface - I might work on that a
> > little today and see what come up with.
>
> > - Lee
>
> > On 8 June 2010 14:30, thepixeldevelo...@googlemail.com
> > <mailto:thepixeldevelo...@googlemail.com>
> > <thepixeldevelo...@googlemail.com
> > <mailto:thepixeldevelo...@googlemail.com>> wrote:
>
> >     Not being a ruby programmer I thought it would be as easy as appending
> >     "--recursive" to the command. I'm out of my depth, so I'll have to let
> >     someone more qualified do the work (happy to learn how it's done
> >     though).
>
> >     -Mathew
>
> >     On Jun 8, 1:16 pm, Lee Hambley <lee.hamb...@gmail.com
> >     <mailto:lee.hamb...@gmail.com>> wrote:
> >     > Matthew,
>
> >     > I need to make this a bigger patch to allow people to set their
> >     git options,
> >     > as the recursive thing isn't required for everyone � although it
> >     does make
> >     > sense; happy to work with you on this, or take a patch - your call.
>
> >     > - Lee
>
> >     > On 8 June 2010 14:05, thepixeldevelo...@googlemail.com
> >     <mailto:thepixeldevelo...@googlemail.com> <
>
> >     > thepixeldevelo...@googlemail.com
> >     <mailto:thepixeldevelo...@googlemail.com>> wrote:
> >     > > Hi there,
>
> >     > > Capistrano should be using the "--recursive" argument on "git
> >     > > submodule update" to update any nested submodules. I have a few
> >     > > scenarios where submodules contain other submodules (usually
> >     vendor
> >     > > code).
>
> >     > > I can create a ticket on lighthouse and create the patch if
> >     need be.
>
> >     > > Documentation:
> >     > >http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html
> >     > > Related lines of code:
> >     > > -
>
> >     >http://github.com/capistrano/capistrano/blob/master/lib/capistrano/re...
> >     > > -
>
> >     >http://github.com/capistrano/capistrano/blob/master/lib/capistrano/re...
>
> >     > > Kind Regards,
> >     > > -Mathew Davies.
>
> >     > > --
> >     > > * You received this message because you are subscribed to the
> >     Google Groups
> >     > > "Capistrano" group.
> >     > > * To post to this group, send email to
> >     capis...@googlegroups.com <mailto:capis...@googlegroups.com>
> >     > > * To unsubscribe from this group, send email to
> >     > > capistrano+...@googlegroups.com
> >     <mailto:capistrano%2Bunsu...@googlegroups.com><capistrano%2Bunsubscribe @googlegrou
> >     ps.com <http://ps.com>>For more options, visit this group at
> >     > >http://groups.google.com/group/capistrano?hl=en
>
> >     --
> >     * You received this message because you are subscribed to the
> >     Google Groups "Capistrano" group.
> >     * To post to this group, send email to capis...@googlegroups.com
> >     <mailto:capis...@googlegroups.com>
> >     * To unsubscribe from this group, send email to
> >     capistrano+...@googlegroups.com
> >     <mailto:capistrano%2Bunsu...@googlegroups.com> For more
> >     options, visit this group at
> >    http://groups.google.com/group/capistrano?hl=en
>
> > --
> > * You received this message because you are subscribed to the Google
> > Groups "Capistrano" group.
> > * To post to this group, send email to capis...@googlegroups.com
> > * To unsubscribe from this group, send email to
> > capistrano+...@googlegroups.com For more options, visit this
> > group athttp://groups.google.com/group/capistrano?hl=en
>
> --
> Rafa

thepixel...@googlemail.com

unread,
Jul 6, 2010, 9:47:07 PM7/6/10
to Capistrano
I forgot to add that running the following commands don't have the
same effect.

git submodule init
git submodule sync
git submodule update --recursive

wont recurse into the submodule directories and checkout any
submodules that reside in them. I'm not sure if this is a git bug or
not.

On Jul 7, 2:39 am, "thepixeldevelo...@googlemail.com"

thepixel...@googlemail.com

unread,
Jul 7, 2010, 5:25:26 PM7/7/10
to Capistrano
Patch file

http://github.com/ThePixelDeveloper/capistrano/commit/53418c054331c5dbaaa2e13a636a2e99d87d6d96.patch

and the commit

http://github.com/ThePixelDeveloper/capistrano/commit/53418c054331c5dbaaa2e13a636a2e99d87d6d96

I might have missed some bits. Can someone review this for me and I'll
get it ready for merging.

On Jul 7, 2:47 am, "thepixeldevelo...@googlemail.com"

Lee Hambley

unread,
Jul 7, 2010, 5:55:36 PM7/7/10
to capis...@googlegroups.com
Mathew,

Documentation, tests and a pull request via github please! (first glance looks OK)

- Lee

thepixel...@googlemail.com

unread,
Jul 7, 2010, 9:44:06 PM7/7/10
to Capistrano
Where should I update the documentation? The header comments or wiki?

Lee Hambley

unread,
Jul 8, 2010, 6:03:21 AM7/8/10
to capis...@googlegroups.com
Github wiki works best, although where appropriate updating the in-code documentation, or the git part of the wiki would suffice. (either way let us know where it is!)

- Lee

Mathew Davies

unread,
Jul 8, 2010, 2:55:35 PM7/8/10
to Capistrano
I've added some tests and documentation. There's 1 bit of code that I
don't know how to handle:

http://github.com/ThePixelDeveloper/capistrano/blob/10e9321982b7eaa1daa7b66eae4bf5e6da3df7b6/lib/capistrano/recipes/deploy/scm/git.rb#L198

Can someone help a newbie ruby programmer out?

It's working correctly for checkout/export anyway (which is my main
use). One last thing, export should be removing all .git directories
from submodules too.

On Jul 8, 11:03 am, Lee Hambley <lee.hamb...@gmail.com> wrote:
> Github wiki works best, although where appropriate updating the in-code
> documentation, or the git part of the wiki would suffice. (either way let us
> know where it is!)
>
> - Lee
>
> On 8 July 2010 03:44, thepixeldevelo...@googlemail.com <
>
>
>
> thepixeldevelo...@googlemail.com> wrote:
> > Where should I update the documentation? The header comments or wiki?
>
> > On Jul 7, 10:55 pm, Lee Hambley <lee.hamb...@gmail.com> wrote:
> > > Mathew,
>
> > > Documentation, tests and a pull request via github please! (first glance
> > > looks OK)
>
> > > - Lee
>
> > --
> > * You received this message because you are subscribed to the Google Groups
> > "Capistrano" group.
> > * To post to this group, send email to capis...@googlegroups.com
> > * To unsubscribe from this group, send email to
> > capistrano+...@googlegroups.com<capistrano%2Bunsubscribe@googlegrou ps.com>For more options, visit this group at
> >http://groups.google.com/group/capistrano?hl=en

Mathew Davies

unread,
Jul 20, 2010, 10:17:13 PM7/20/10
to Capistrano
Any comment Lee?

On Jul 8, 7:55 pm, Mathew Davies <thepixeldevelo...@googlemail.com>
wrote:
> I've added some tests and documentation. There's 1 bit of code that I
> don't know how to handle:
>
> http://github.com/ThePixelDeveloper/capistrano/blob/10e9321982b7eaa1d...

Lee Hambley

unread,
Jul 21, 2010, 3:47:10 AM7/21/10
to capis...@googlegroups.com
Hi Matt,

Sorry I've been on vacation - let me get back to you today.

- Lee

Lee Hambley

unread,
Jul 27, 2010, 10:12:03 AM7/27/10
to capis...@googlegroups.com
Hi Matt,

If I understood then this `fix` breaks compatibility with some other features (read: it breaks the tests).

- Lee

Mathew Davies

unread,
Jul 27, 2010, 10:21:16 AM7/27/10
to Capistrano
Yeah it does.

On Jul 27, 3:12 pm, Lee Hambley <lee.hamb...@gmail.com> wrote:
> Hi Matt,
>
> If I understood then this `fix` breaks compatibility with some other
> features (read: it breaks the tests).
>
> - Lee
>
Reply all
Reply to author
Forward
0 new messages