git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [RFC PATCH 0/2] Add an update=none option for 'loose' submodules
@ 2011-06-06 20:57 Heiko Voigt
  2011-06-06 20:57 ` [RFC PATCH 1/2] submodule: move update configuration variable further up Heiko Voigt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Heiko Voigt @ 2011-06-06 20:57 UTC (permalink / raw
  To: git

If a submodule is used to seperate some bigger parts of a project into
an optional directory it is helpful to not clone/update them by default.

This series implements a new value 'none' for submodule.<name>.update.
If this option is set a submodule will not be updated or cloned by
default. If the user wants to work with the submodule he either needs
to explicitely configure the update option to 'checkout' or pass
--checkout as an option to the submodules. I chose this name to be
consistent with the existing --merge/--rebase options.

What do you think about this approach?

If we agree that this is the correct way to approach this use case I
would proceed to implement tests and documentation.

Cheers Heiko

Heiko Voigt (2):
  submodule: move update configuration variable further up
  add update 'none' flag to disable update of submodule by default

 git-submodule.sh |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

-- 
1.7.5.1.219.g4c6b2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC PATCH 1/2] submodule: move update configuration variable further up
  2011-06-06 20:57 [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Heiko Voigt
@ 2011-06-06 20:57 ` Heiko Voigt
  2011-06-06 20:57 ` [RFC PATCH 2/2] add update 'none' flag to disable update of submodule by default Heiko Voigt
  2011-06-09 18:06 ` [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Jens Lehmann
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Voigt @ 2011-06-06 20:57 UTC (permalink / raw
  To: git

Lets always initialize the 'update_module' variable with the final
value. This way we allow code which wants to check this configuration
early to do so right in the beginning of cmd_update().
---
 git-submodule.sh |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index d189a24..70dfc7b 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -454,7 +454,13 @@ cmd_update()
 		fi
 		name=$(module_name "$path") || exit
 		url=$(git config submodule."$name".url)
-		update_module=$(git config submodule."$name".update)
+		if ! test -z "$update"
+		then
+			update_module=$update
+		else
+			update_module=$(git config submodule."$name".update)
+		fi
+
 		if test -z "$url"
 		then
 			# Only mention uninitialized submodules when its
@@ -476,11 +482,6 @@ cmd_update()
 			die "Unable to find current revision in submodule path '$path'"
 		fi
 
-		if ! test -z "$update"
-		then
-			update_module=$update
-		fi
-
 		if test "$subsha1" != "$sha1"
 		then
 			subforce=$force
-- 
1.7.5.1.219.g4c6b2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC PATCH 2/2] add update 'none' flag to disable update of submodule by default
  2011-06-06 20:57 [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Heiko Voigt
  2011-06-06 20:57 ` [RFC PATCH 1/2] submodule: move update configuration variable further up Heiko Voigt
@ 2011-06-06 20:57 ` Heiko Voigt
  2011-06-09 18:06 ` [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Jens Lehmann
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Voigt @ 2011-06-06 20:57 UTC (permalink / raw
  To: git

This is useful to mark a submodule as unneeded by default. When this
option is set and the user wants to work with such a submodule he
needs to configure 'submodule.<name>.update=checkout' or pass the
--checkout option. Then the submodule can be handled like a normal
submodule.

TODO: Documentation/Tests
---
 git-submodule.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 70dfc7b..77977b5 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -423,6 +423,9 @@ cmd_update()
 		--recursive)
 			recursive=1
 			;;
+		--checkout)
+			update="checkout"
+			;;
 		--)
 			shift
 			break
@@ -461,6 +464,12 @@ cmd_update()
 			update_module=$(git config submodule."$name".update)
 		fi
 
+		if test "$update_module" = "none"
+		then
+			echo "Skipping submodule '$path'"
+			continue
+		fi
+
 		if test -z "$url"
 		then
 			# Only mention uninitialized submodules when its
-- 
1.7.5.1.219.g4c6b2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/2] Add an update=none option for 'loose' submodules
  2011-06-06 20:57 [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Heiko Voigt
  2011-06-06 20:57 ` [RFC PATCH 1/2] submodule: move update configuration variable further up Heiko Voigt
  2011-06-06 20:57 ` [RFC PATCH 2/2] add update 'none' flag to disable update of submodule by default Heiko Voigt
@ 2011-06-09 18:06 ` Jens Lehmann
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Lehmann @ 2011-06-09 18:06 UTC (permalink / raw
  To: Heiko Voigt; +Cc: git

Am 06.06.2011 22:57, schrieb Heiko Voigt:
> If a submodule is used to seperate some bigger parts of a project into
> an optional directory it is helpful to not clone/update them by default.

I think this is a good idea as some people are running "git submodule
update --init --recursive" when they have to update their submodules.
It would be nice to have an option to skip certain submodules then.

> This series implements a new value 'none' for submodule.<name>.update.
> If this option is set a submodule will not be updated or cloned by
> default. If the user wants to work with the submodule he either needs
> to explicitely configure the update option to 'checkout' or pass
> --checkout as an option to the submodules. I chose this name to be
> consistent with the existing --merge/--rebase options.
> 
> What do you think about this approach?

It fits in nicely with my long term plan: Let the "update" flag
control what happens on submodule checkout in the work tree. Another
flag ("init"?) can be added later to control if a submodule should be
initialized on clone or update, but that is outside the scope of this
change.

> If we agree that this is the correct way to approach this use case I
> would proceed to implement tests and documentation.

+1 from me.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-09 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 20:57 [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Heiko Voigt
2011-06-06 20:57 ` [RFC PATCH 1/2] submodule: move update configuration variable further up Heiko Voigt
2011-06-06 20:57 ` [RFC PATCH 2/2] add update 'none' flag to disable update of submodule by default Heiko Voigt
2011-06-09 18:06 ` [RFC PATCH 0/2] Add an update=none option for 'loose' submodules Jens Lehmann

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).