From: Fabian Franz <git@fabian-franz.de>
To: git@vger.kernel.org
Cc: j.sixt@viscovery.net, hjemli@gmail.com, gitster@pobox.com,
Fabian Franz <git@fabian-franz.de>
Subject: [PATCH v4] submodule: add --recursive parameter to update command
Date: Sat, 10 Jan 2009 00:10:10 -0200 [thread overview]
Message-ID: <1231553410-7541-5-git-send-email-git@fabian-franz.de> (raw)
In-Reply-To: <1231553410-7541-4-git-send-email-git@fabian-franz.de>
If --recursive is specified on update, then recursively check for
.gitmodules in each updated submodule and run init and update commands.
The update command is run with the same parameters as the original update
command with the exception of the path.
Signed-off-by: Fabian Franz <git@fabian-franz.de>
---
Documentation/git-submodule.txt | 8 ++++++++
git-submodule.sh | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index fbb18ee..c9adc43 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -188,6 +188,14 @@ OPTIONS
This option is only valid for the update command.
Don't fetch new objects from the remote site.
+-r::
+--recursive::
+ This option is only valid for the update command.
+ Recursively check for .gitmodules in each updated submodule and run
+ init and update commands. The update command is run with the same
+ parameters as the original update command with the exception of the
+ path.
+
-u::
--use-gitmodules::
This option is only valid for the update command.
diff --git a/git-submodule.sh b/git-submodule.sh
index 54b59b2..8bb00b7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -5,7 +5,7 @@
# Copyright (c) 2007 Lars Hjemli
USAGE="[--quiet] [--cached] \
-[add <repo> [-b branch] [--track|-t <branch>] <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [-u|--use-gitmodules]|summary [-n|--summary-limit <n>] [<commit>]] \
+[add <repo> [-b branch] [--track|-t <branch>] <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [-r|--recursive] [-u|--use-gitmodules]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
OPTIONS_SPEC=
. git-sh-setup
@@ -19,6 +19,7 @@ cached=
track=
nofetch=
usegitmodules=
+recursive=
#
# print stuff on stdout unless -q was specified
@@ -319,6 +320,10 @@ cmd_update()
shift
nofetch=1
;;
+ -r|--recursive)
+ shift
+ recursive=1
+ ;;
-u|--use-gitmodules)
shift
usegitmodules=1
@@ -445,6 +450,16 @@ cmd_update()
say "Submodule path '$path': checked out '$sha1'${track:+ ($track)}"
fi
+ if test -n "$recursive" -a -f "$path/.gitmodules"
+ then
+ PARAMS="${quiet:+-q} ${nofetch:+--no-fetch} ${recursive:+-r} ${usegitmodules:+-u}"
+ say "Entering submodule path '$path'"
+ (unset GIT_DIR; cd "$path" &&
+ git-submodule init &&
+ git-submodule update $PARAMS) ||
+ die "Unable to run 'git-submodule update $PARAMS' in submodule path '$path'"
+ say "Leaving submodule path '$path'"
+ fi
done
}
--
1.5.3.6
next prev parent reply other threads:[~2009-01-10 2:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-10 2:10 [PATCH v4] submodule: allow tracking of the newest revision of a branch in a submodule Fabian Franz
2009-01-10 2:10 ` [PATCH v4] submodule: add --no-fetch parameter to update command Fabian Franz
2009-01-10 2:10 ` [PATCH v4] submodule: add --use-gitmodules " Fabian Franz
2009-01-10 2:10 ` [PATCH v4] submodule: add +<branch> syntax for track to allow automatic pulling Fabian Franz
2009-01-10 2:10 ` Fabian Franz [this message]
2009-01-11 1:34 ` Junio C Hamano
2009-01-10 14:23 ` [PATCH v4] submodule: allow tracking of the newest revision of a branch in a submodule Johannes Schindelin
2009-01-11 1:31 ` [PATCH v4] submodule: add --no-fetch parameter to update command Nanako Shiraishi
2009-01-11 1:32 ` Nanako Shiraishi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1231553410-7541-5-git-send-email-git@fabian-franz.de \
--to=git@fabian-franz.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hjemli@gmail.com \
--cc=j.sixt@viscovery.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).