git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 --use-gitmodules parameter to update command
Date: Sat, 10 Jan 2009 00:10:08 -0200	[thread overview]
Message-ID: <1231553410-7541-3-git-send-email-git@fabian-franz.de> (raw)
In-Reply-To: <1231553410-7541-2-git-send-email-git@fabian-franz.de>

When -u|--use-gitmodules is given the update command uses the .gitmodules
config file instead of the .git/config file to obtain the track parameter.
This makes it for example possible to change branches for all submodules
at the same time without having to sync up .git/config first.

Signed-off-by: Fabian Franz <git@fabian-franz.de>
---
 Documentation/git-submodule.txt |    8 +++++++-
 git-submodule.sh                |    9 ++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 14c1d5c..175b4b5 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git submodule' [--quiet] add [-b branch] [-t|--track <branch>] [--] <repository> <path>
 'git submodule' [--quiet] status [--cached] [--] [<path>...]
 'git submodule' [--quiet] init [--] [<path>...]
-'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--] [<path>...]
+'git submodule' [--quiet] update [--init] [-N|--no-fetch] [-u|--use-gitmodules] [--] [<path>...]
 'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
 'git submodule' [--quiet] foreach <command>
 'git submodule' [--quiet] sync [--] [<path>...]
@@ -185,6 +185,12 @@ OPTIONS
 	This option is only valid for the update command.
 	Don't fetch new objects from the remote site.
 
+-u::
+--use-gitmodules::
+	This option is only valid for the update command.
+	Use the tracking information found in .gitmodules
+	(track) and ignore .git/config.
+
 <path>...::
 	Paths to submodule(s). When specified this will restrict the command
 	to only operate on the submodules found at the specified paths.
diff --git a/git-submodule.sh b/git-submodule.sh
index f66622b..81b96dd 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]|summary [-n|--summary-limit <n>] [<commit>]] \
+[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>]] \
 [--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
 OPTIONS_SPEC=
 . git-sh-setup
@@ -18,6 +18,7 @@ quiet=
 cached=
 track=
 nofetch=
+usegitmodules=
 
 #
 # print stuff on stdout unless -q was specified
@@ -318,6 +319,10 @@ cmd_update()
 			shift
 			nofetch=1
 			;;
+		-u|--use-gitmodules)
+			shift
+			usegitmodules=1
+			;;
 		--)
 			shift
 			break
@@ -347,6 +352,8 @@ cmd_update()
 		fi
 
 		track=$(git config submodule."$name".track)
+		test -n "$usegitmodules" &&
+			track=$(git config -f .gitmodules submodule."$name".track)
 		if test -n "$track"
 		then
 			git-update-index --assume-unchanged "$path"
-- 
1.5.3.6

  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   ` Fabian Franz [this message]
2009-01-10  2:10     ` [PATCH v4] submodule: add +<branch> syntax for track to allow automatic pulling Fabian Franz
2009-01-10  2:10       ` [PATCH v4] submodule: add --recursive parameter to update command Fabian Franz
2009-01-11  1:34       ` [PATCH v4] submodule: add +<branch> syntax for track to allow automatic pulling 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-3-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).