git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RESEND] git-submodule: add support for --rebase.

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 23, 2009, 09:20 UTC
Message-ID
<alpine.DEB.1.00.0904231119160.10279@pacific.mpi-cbg.de>
In-Reply-To
<20090423034709.GA22244@dingo.bne.redhat.com>
Hi,
On Thu, 23 Apr 2009, Peter Hutterer wrote:
Show 17 quoted lines
> 'git submodule update --rebase' rebases your local branch on top of what
> would have been checked out to a detached HEAD otherwise.
> 
> In some cases, detaching the HEAD when updating a submodule complicates
> the workflow to commit to this submodule (checkout master, rebase, then
> commit).  For submodules that require frequent updates but infrequent
> (if any) commits, a rebase can be executed directly by the git-submodule
> command, ensuring that the submodules stay on their respective branches.
> 
> git-config key: submodule.$name.rebase (bool)
> 
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---
> 
> I figured if we're waiting for 1.6.3 anyway I might as well add support
> for gitconfig to make this feature "complete".
> Test cases are updated as well.
Thanks.

With this squashed in, I actually would not be too opposed to put this into 1.6.3, as it _is_ an improvement.

-- snipsnap -- [PATCH] To be squashed in

This does three things:
- add .gitmodules support for rebase,
- use --bool for the git config calls for type checking, and
- rename ambiguous t7404 to t7406.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Documentation/gitmodules.txt                       |    3 +++
 git-submodule.sh                                   |    7 ++++++-
 ...bmodule-update.sh => t7406-submodule-update.sh} |   10 ++++++++++
 3 files changed, 19 insertions(+), 1 deletions(-)
 rename t/{t7404-submodule-update.sh => t7406-submodule-update.sh} (88%)
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
index d1a17e2..7c22c40 100644
--- a/Documentation/gitmodules.txt
+++ b/Documentation/gitmodules.txt
@@ -30,6 +30,9 @@ submodule.<name>.path::
 submodule.<name>.url::
 	Defines an url from where the submodule repository can be cloned.
 
+submodule.<name>.rebase::
+	Defines that the submodule should be rebased by default.
+
 
 EXAMPLES
 --------
diff --git a/git-submodule.sh b/git-submodule.sh
index 091cb2d..3176226 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -295,6 +295,11 @@ cmd_init()
 		git config submodule."$name".url "$url" ||
 		die "Failed to register url for submodule path '$path'"
 
+		test true != "$(git config -f .gitmodules --bool \
+			submodule."$name".rebase)" ||
+		git config submodule."$name".rebase true ||
+		die "Failed to register submodule path '$path' as rebasing"
+
 		say "Submodule '$name' ($url) registered for path '$path'"
 	done
 }
@@ -344,7 +349,7 @@ cmd_update()
 	do
 		name=$(module_name "$path") || exit
 		url=$(git config submodule."$name".url)
-		rebase_module=$(git config submodule."$name".rebase)
+		rebase_module=$(git config --bool submodule."$name".rebase)
 		if test -z "$url"
 		then
 			# Only mention uninitialized submodules when its
diff --git a/t/t7404-submodule-update.sh b/t/t7406-submodule-update.sh
similarity index 88%
rename from t/t7404-submodule-update.sh
rename to t/t7406-submodule-update.sh
index d70bae1..3a474be 100755
--- a/t/t7404-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -127,4 +127,14 @@ test_expect_success 'submodule update - rebase false in .git/config' '
 	)
 '
 
+test_expect_success 'submodule init picks up rebase' '
+	(cd super &&
+	 git config submodule.rebasing.url git://non-existing/git &&
+	 git config submodule.rebasing.path does-not-mater &&
+	 git config submodule.rebasing.rebase true &&
+	 git submodule init rebasing &&
+	 test true = $(git config --bool submodule.rebasing.rebase)
+	)
+'
+
 test_done
-- 
1.6.2.1.613.g25746
Previous: Peter HuttererNext: Peter Hutterer
Message 6 of 9 in “git-submodule: add support for --rebase.”
  1. git-submodule: add support for --rebase.Peter Hutterer, Apr 19, 2009
  2. Johannes SchindelinApr 20, 2009
  3. Peter HuttererApr 21, 2009
  4. Johannes SchindelinApr 21, 2009
  5. Peter HuttererApr 23, 2009
  6. Johannes SchindelinApr 23, 2009
  7. Peter HuttererApr 23, 2009
  8. Johannes SchindelinApr 24, 2009
  9. Junio C HamanoApr 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.