<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Recursively Updating Git Submodules</title>
	<atom:link href="http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/</link>
	<description>Linux, WordPress, programming, anime, and other stuff</description>
	<lastBuildDate>Fri, 18 May 2012 19:58:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Chris Jean</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12658</link>
		<dc:creator>Chris Jean</dc:creator>
		<pubDate>Thu, 23 Jun 2011 18:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12658</guid>
		<description>No biggie. I wasn&#039;t put off. Just commentating. :)</description>
		<content:encoded><![CDATA[<p>No biggie. I wasn&#8217;t put off. Just commentating. <img src='http://chrisjean.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris M.</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12657</link>
		<dc:creator>Chris M.</dc:creator>
		<pubDate>Thu, 23 Jun 2011 18:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12657</guid>
		<description>Yes and no.

My apologies. That part wasn&#039;t really meant to be posted. I figgered you would remove it. I mainly added it because I just noticed that the last couple of posts had been hanging around for a couple of days, and wanted to find out if this thing was on.

It is. Thanks for unclogging the pipes.

I did send an apology to you privately, but I believe that apologies should be delivered in the same venue as the transgression, so I&#039;ll repeat it here.</description>
		<content:encoded><![CDATA[<p>Yes and no.</p>
<p>My apologies. That part wasn&#8217;t really meant to be posted. I figgered you would remove it. I mainly added it because I just noticed that the last couple of posts had been hanging around for a couple of days, and wanted to find out if this thing was on.</p>
<p>It is. Thanks for unclogging the pipes.</p>
<p>I did send an apology to you privately, but I believe that apologies should be delivered in the same venue as the transgression, so I&#8217;ll repeat it here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Jean</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12656</link>
		<dc:creator>Chris Jean</dc:creator>
		<pubDate>Thu, 23 Jun 2011 18:10:45 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12656</guid>
		<description>A bit dramatic are we?</description>
		<content:encoded><![CDATA[<p>A bit dramatic are we?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Jean</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12655</link>
		<dc:creator>Chris Jean</dc:creator>
		<pubDate>Thu, 23 Jun 2011 18:09:37 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12655</guid>
		<description>Updated. Thanks for pointing that out.</description>
		<content:encoded><![CDATA[<p>Updated. Thanks for pointing that out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris M.</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12654</link>
		<dc:creator>Chris M.</dc:creator>
		<pubDate>Thu, 23 Jun 2011 18:08:35 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12654</guid>
		<description>I guess this comment will never see the light of day (might as well delete the previous two, if you ever get around to it).

You guys might find &lt;a href=&quot;https://github.com/MAGSHARE/MAGSHARE-Utilities/blob/master/Git%20Utilities/gitupdate.pl&quot; rel=&quot;nofollow&quot;&gt;this script&lt;/a&gt; useful. I read up on submodules, figgered out where I was wrong, and adjusted the script accordingly. I also figured out that I like the way Git handles submodules a bit better, after reading &lt;a href=&quot;http://longair.net/blog/2010/06/02/git-submodules-explained/&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>I guess this comment will never see the light of day (might as well delete the previous two, if you ever get around to it).</p>
<p>You guys might find <a href="https://github.com/MAGSHARE/MAGSHARE-Utilities/blob/master/Git%20Utilities/gitupdate.pl" rel="nofollow">this script</a> useful. I read up on submodules, figgered out where I was wrong, and adjusted the script accordingly. I also figured out that I like the way Git handles submodules a bit better, after reading <a href="http://longair.net/blog/2010/06/02/git-submodules-explained/" rel="nofollow">this article</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris M.</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12602</link>
		<dc:creator>Chris M.</dc:creator>
		<pubDate>Tue, 21 Jun 2011 20:22:01 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12602</guid>
		<description>Just for the heck of it, I decided to work on a version with a more direct hierarchy. I want to make absolutely sure that nested submodules are followed properly. This should also be easier to convert to other languages (I&#039;ll bet that you&#039;d never guess that Perl&#039;s not my native language ;):

#!/usr/bin/perl

use strict;
use Cwd;

# You can specify a starting directory as the script argument.
if ( $_[0] )
    {
    chdir ( $_[0] );
    }

my $global_indent = 0;
print ( &#039;Searching the base project at &quot;&#039;, cwd(), &#039;&quot;&#039; );
init_and_update();
print ( &quot;\n&quot; );

exit;

# This function is a recursive function that will traverse a submodule hierarchy,
# and will update them, from the bottom up.
sub init_and_update
{
	my @submodules;
	# First, you must have submodules.
    if ( open ( GITFILE, &#039;.gitmodules&#039; ) )
        {
        my $heading;

        # If so, we parse the .gitmodules file, and get the important parts.
        # This is a REAL DUMB parser. It counts on the lines being in a particular order.
        # This is Perl. We can do better.
        while ( $heading =  )
            {
            my $pathname;
            my $url;
    
            # The heading is the submodule header (and name).
            chomp ( $heading );
            $heading =~ s/^\s+//;
            $heading =~ s/\s+$//;
            
            # If we have a submodule...
            if ( $heading =~ m/\[submodule / )
                {
                # Strip off the extra
                $heading =~ s/\[submodule &quot;(.*?)&quot;\]/$1/;
                
                # Get the pathname
                $pathname = ;
                chomp ( $pathname ); 
                $pathname =~ s/^\s+//;
                $pathname =~ s/\s+$//;
                $pathname =~ s/path = (.*?)$/$1/;
                
                # Get the URL of the origin
                $url = ;
                chomp ( $url );
                $url =~ s/^\s+//;
                $url =~ s/\s+$//;
                $url =~ s/url = (.*?)$/$1/;
                
                # Add it to our stack.
                push @submodules, { &#039;submodule&#039; =&gt; $heading, &#039;pathname&#039; =&gt; $pathname, &#039;url&#039; =&gt; $url } ;
                }
            }
        
        close ( GITFILE );
        }
        
    # Make sure that we got some submodules.
    if ( @submodules &gt; 0 )
        {
        output_indents();
        print ( &quot;This directory has the following submodules:&quot; );
        
        $global_indent++;
        for my $index ( 0 .. $#submodules )
            {
            output_indents();
            print ( $index + 1, &#039;) &#039;, $submodules[$index] { &#039;submodule&#039; } );
            }
        $global_indent--;
        
        # Now, we simply go through the list, recursing all the way...
        for my $index ( 0 .. $#submodules )
            {
            # Recursion
            my $start_path = cwd();
            chdir ( $submodules[$index] { &#039;pathname&#039; } );
            output_indents();
            print ( &quot;Looking for submodules under the &quot;, $submodules[$index] { &#039;submodule&#039; }, &quot; submodule&quot; );
            $global_indent++;
            init_and_update();
            $global_indent--;
            chdir ( $start_path );
            }
        
        # Lets do our own.
        `git submodule init 2&gt;&amp;1`;
        `git submodule update 2&gt;&amp;1`;
        `git submodule foreach &#039;git checkout HEAD&#039; 2&gt;&amp;1`;
        output_indents();
        print ( &quot;Updated the submodules in the \&quot;&quot;, cwd(), &quot;\&quot; directory&quot; );
        }
    else
        {
        output_indents();
        print ( &quot;No further submodules under this directory&quot; );
        }
}

# This simply helps the user to see the hierarchy of the operation.
sub output_indents
{
    print ( &quot;\n&quot; );
    
    for my $index ( 0 .. $global_indent )
        {
        print ( &quot;  &quot; );
        }
}</description>
		<content:encoded><![CDATA[<p>Just for the heck of it, I decided to work on a version with a more direct hierarchy. I want to make absolutely sure that nested submodules are followed properly. This should also be easier to convert to other languages (I&#8217;ll bet that you&#8217;d never guess that Perl&#8217;s not my native language <img src='http://chrisjean.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> :</p>
<p>#!/usr/bin/perl</p>
<p>use strict;<br />
use Cwd;</p>
<p># You can specify a starting directory as the script argument.<br />
if ( $_[0] )<br />
    {<br />
    chdir ( $_[0] );<br />
    }</p>
<p>my $global_indent = 0;<br />
print ( &#8216;Searching the base project at &#8220;&#8216;, cwd(), &#8216;&#8221;&#8216; );<br />
init_and_update();<br />
print ( &#8220;\n&#8221; );</p>
<p>exit;</p>
<p># This function is a recursive function that will traverse a submodule hierarchy,<br />
# and will update them, from the bottom up.<br />
sub init_and_update<br />
{<br />
	my @submodules;<br />
	# First, you must have submodules.<br />
    if ( open ( GITFILE, &#8216;.gitmodules&#8217; ) )<br />
        {<br />
        my $heading;</p>
<p>        # If so, we parse the .gitmodules file, and get the important parts.<br />
        # This is a REAL DUMB parser. It counts on the lines being in a particular order.<br />
        # This is Perl. We can do better.<br />
        while ( $heading =  )<br />
            {<br />
            my $pathname;<br />
            my $url;</p>
<p>            # The heading is the submodule header (and name).<br />
            chomp ( $heading );<br />
            $heading =~ s/^\s+//;<br />
            $heading =~ s/\s+$//;</p>
<p>            # If we have a submodule&#8230;<br />
            if ( $heading =~ m/\[submodule / )<br />
                {<br />
                # Strip off the extra<br />
                $heading =~ s/\[submodule "(.*?)"\]/$1/;</p>
<p>                # Get the pathname<br />
                $pathname = ;<br />
                chomp ( $pathname );<br />
                $pathname =~ s/^\s+//;<br />
                $pathname =~ s/\s+$//;<br />
                $pathname =~ s/path = (.*?)$/$1/;</p>
<p>                # Get the URL of the origin<br />
                $url = ;<br />
                chomp ( $url );<br />
                $url =~ s/^\s+//;<br />
                $url =~ s/\s+$//;<br />
                $url =~ s/url = (.*?)$/$1/;</p>
<p>                # Add it to our stack.<br />
                push @submodules, { &#8216;submodule&#8217; =&gt; $heading, &#8216;pathname&#8217; =&gt; $pathname, &#8216;url&#8217; =&gt; $url } ;<br />
                }<br />
            }</p>
<p>        close ( GITFILE );<br />
        }</p>
<p>    # Make sure that we got some submodules.<br />
    if ( @submodules &gt; 0 )<br />
        {<br />
        output_indents();<br />
        print ( &#8220;This directory has the following submodules:&#8221; );</p>
<p>        $global_indent++;<br />
        for my $index ( 0 .. $#submodules )<br />
            {<br />
            output_indents();<br />
            print ( $index + 1, &#8216;) &#8216;, $submodules[$index] { &#8216;submodule&#8217; } );<br />
            }<br />
        $global_indent&#8211;;</p>
<p>        # Now, we simply go through the list, recursing all the way&#8230;<br />
        for my $index ( 0 .. $#submodules )<br />
            {<br />
            # Recursion<br />
            my $start_path = cwd();<br />
            chdir ( $submodules[$index] { &#8216;pathname&#8217; } );<br />
            output_indents();<br />
            print ( &#8220;Looking for submodules under the &#8220;, $submodules[$index] { &#8216;submodule&#8217; }, &#8221; submodule&#8221; );<br />
            $global_indent++;<br />
            init_and_update();<br />
            $global_indent&#8211;;<br />
            chdir ( $start_path );<br />
            }</p>
<p>        # Lets do our own.<br />
        `git submodule init 2&gt;&amp;1`;<br />
        `git submodule update 2&gt;&amp;1`;<br />
        `git submodule foreach &#8216;git checkout HEAD&#8217; 2&gt;&amp;1`;<br />
        output_indents();<br />
        print ( &#8220;Updated the submodules in the \&#8221;", cwd(), &#8220;\&#8221; directory&#8221; );<br />
        }<br />
    else<br />
        {<br />
        output_indents();<br />
        print ( &#8220;No further submodules under this directory&#8221; );<br />
        }<br />
}</p>
<p># This simply helps the user to see the hierarchy of the operation.<br />
sub output_indents<br />
{<br />
    print ( &#8220;\n&#8221; );</p>
<p>    for my $index ( 0 .. $global_indent )<br />
        {<br />
        print ( &#8221;  &#8221; );<br />
        }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris M.</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-12561</link>
		<dc:creator>Chris M.</dc:creator>
		<pubDate>Mon, 20 Jun 2011 12:30:30 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-12561</guid>
		<description>Howdy,

Quick typo correction on your new line:

`git submodule foreach ‘git checkout master’ 2&gt;&amp;1 Is in the script.

It should be:

`git submodule foreach ‘git checkout master’ 2&gt;&amp;1`;</description>
		<content:encoded><![CDATA[<p>Howdy,</p>
<p>Quick typo correction on your new line:</p>
<p>`git submodule foreach ‘git checkout master’ 2&gt;&amp;1 Is in the script.</p>
<p>It should be:</p>
<p>`git submodule foreach ‘git checkout master’ 2&gt;&amp;1`;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Jean</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-11116</link>
		<dc:creator>Chris Jean</dc:creator>
		<pubDate>Mon, 04 Apr 2011 13:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-11116</guid>
		<description>Thanks a good addition. Thanks for sharing it.</description>
		<content:encoded><![CDATA[<p>Thanks a good addition. Thanks for sharing it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver Schrenk</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-11034</link>
		<dc:creator>Oliver Schrenk</dc:creator>
		<pubDate>Thu, 31 Mar 2011 13:30:47 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-11034</guid>
		<description>Thanks a bunch. I have a deeply nested project and when I started writing the script to and thought there had to be someone wit a similar problem.

I just added one line

[...]
`git submodule init 2&gt;&amp;1`;
`git submodule update 2&gt;&amp;1`;
`git submodule foreach &#039;git checkout master&#039; 2&gt;&amp;1`;</description>
		<content:encoded><![CDATA[<p>Thanks a bunch. I have a deeply nested project and when I started writing the script to and thought there had to be someone wit a similar problem.</p>
<p>I just added one line</p>
<p>[...]<br />
`git submodule init 2&gt;&amp;1`;<br />
`git submodule update 2&gt;&amp;1`;<br />
`git submodule foreach &#8216;git checkout master&#8217; 2&gt;&amp;1`;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Forgue</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/comment-page-1/#comment-2708</link>
		<dc:creator>Aaron Forgue</dc:creator>
		<pubDate>Thu, 02 Dec 2010 14:43:09 +0000</pubDate>
		<guid isPermaLink="false">http://gaarai.com/?p=1528#comment-2708</guid>
		<description>This is fantastic and will help us solve a similar scenario. Thank you so much for posting this!</description>
		<content:encoded><![CDATA[<p>This is fantastic and will help us solve a similar scenario. Thank you so much for posting this!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

