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

[PATCH 10/15] git-checkout: pass --submodules option to git-read-tree

From
Sskimo@liacs.nl <skimo@liacs.nl>
Date
May 20, 2007, 18:04 UTC
Message-ID
<11796842892738-git-send-email-skimo@liacs.nl>
In-Reply-To
<11796842882917-git-send-email-skimo@liacs.nl>
From: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
---
 git-checkout.sh |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/git-checkout.sh b/git-checkout.sh
index 6b6facf..162cef4 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-USAGE='[-q] [-f] [-b <new_branch>] [-m] [<branch>] [<paths>...]'
+USAGE='[-q] [-f] [--submodules] [--no-submodules] [-b <new_branch>] [-m] [<branch>] [<paths>...]'
 SUBDIRECTORY_OK=Sometimes
 . git-sh-setup
 require_work_tree
@@ -16,6 +16,7 @@ track=
 newbranch=
 newbranch_log=
 merge=
+submodules=
 quiet=
 v=-v
 LF='
@@ -46,6 +47,15 @@ while [ "$#" != "0" ]; do
 	-m)
 		merge=1
 		;;
+	--su|--sub|--subm|--submo|--submod|--submodu|--submodul|\
+	--submodule|--submodules)
+		submodules="--submodules"
+		;;
+	--no-su|--no-sub|--no-subm|--no-submo|--no-submod|\
+	--no-submodu|--no-submodul|\
+	--no-submodule|--no-submodules)
+		submodules="--no-submodules"
+		;;
 	"-q")
 		quiet=1
 		v=
@@ -199,10 +209,10 @@ fi
 
 if [ "$force" ]
 then
-    git-read-tree $v --reset -u $new
+    git-read-tree $v $submodules --reset -u $new
 else
     git-update-index --refresh >/dev/null
-    merge_error=$(git-read-tree -m -u --exclude-per-directory=.gitignore $old $new 2>&1) || (
+    merge_error=$(git-read-tree $submodules -m -u --exclude-per-directory=.gitignore $old $new 2>&1) || (
 	case "$merge" in
 	'')
 		echo >&2 "$merge_error"
@@ -212,7 +222,7 @@ else
 	# Match the index to the working tree, and do a three-way.
     	git diff-files --name-only | git update-index --remove --stdin &&
 	work=`git write-tree` &&
-	git read-tree $v --reset -u $new || exit
+	git read-tree $v $submodules --reset -u $new || exit
 
 	eval GITHEAD_$new='${new_name:-${branch:-$new}}' &&
 	eval GITHEAD_$work=local &&
@@ -223,7 +233,7 @@ else
 	# this is not a real merge before committing, but just carrying
 	# the working tree changes along.
 	unmerged=`git ls-files -u`
-	git read-tree $v --reset $new
+	git read-tree $v $submodules --reset $new
 	case "$unmerged" in
 	'')	;;
 	*)
-- 
1.5.2.rc3.815.g8fc2
Previous: Sven VerdoolaegeNext: skimo@liacs.nl
Message 19 of 53 in “[RFC] Third round of support for cloning submodules”
  1. skimo@liacs.nlMay 20, 2007
  2. 01/15 Add dump-configskimo@liacs.nl, May 20, 2007
  3. 02/15 git-config: add --remote option for reading config from remote reposkimo@liacs.nl, May 20, 2007
  4. Frank LichtenheldMay 20, 2007
  5. Sven VerdoolaegeMay 20, 2007
  6. Frank LichtenheldMay 20, 2007
  7. 03/15 http.h: make fill_active_slots a function pointerskimo@liacs.nl, May 20, 2007
  8. 04/15 git-config: read remote config files over HTTPskimo@liacs.nl, May 20, 2007
  9. 05/15 unpack-trees.c: pass cache_entry * to verify_absent rather than just the nameskimo@liacs.nl, May 20, 2007
  10. 06/15 git-read-tree: take --submodules optionskimo@liacs.nl, May 20, 2007
  11. Martin WaitzMay 20, 2007
  12. Sven VerdoolaegeMay 20, 2007
  13. 07/15 unpack-trees.c: assume submodules are cleanskimo@liacs.nl, May 20, 2007
  14. 08/15 Add run_command_v_opt_cd: chdir into a directory before execskimo@liacs.nl, May 20, 2007
  15. 09/15 entry.c: optionally checkout submodulesskimo@liacs.nl, May 20, 2007
  16. Martin WaitzMay 20, 2007
  17. Sven VerdoolaegeMay 20, 2007
  18. Sven VerdoolaegeMay 24, 2007
  19. 10/15 git-checkout: pass --submodules option to git-read-treeskimo@liacs.nl, May 20, 2007
  20. 11/15 git-read-tree: treat null commit as empty treeskimo@liacs.nl, May 20, 2007
  21. 12/15 git_config: add void * for callback dataskimo@liacs.nl, May 20, 2007
  22. 13/15 unpack-trees.c: optionally clone submodules for later checkoutskimo@liacs.nl, May 20, 2007
  23. 14/15 entry.c: optionall checkout newly cloned submodulesskimo@liacs.nl, May 20, 2007
  24. 15/15 git-clone: add --submodules for cloning submodulesskimo@liacs.nl, May 20, 2007
  25. Junio C HamanoMay 20, 2007
  26. Sven VerdoolaegeMay 20, 2007
  27. Alex RiesenMay 20, 2007
  28. Sven VerdoolaegeMay 20, 2007
  29. Alex RiesenMay 20, 2007
  30. Sven VerdoolaegeMay 20, 2007
  31. Alex RiesenMay 20, 2007
  32. Sven VerdoolaegeMay 21, 2007
  33. Josef WeidendorferMay 21, 2007
  34. Martin WaitzMay 21, 2007
  35. Martin WaitzMay 20, 2007
  36. Alex RiesenMay 20, 2007
  37. Martin WaitzMay 20, 2007
  38. Alex RiesenMay 20, 2007
  39. Martin WaitzMay 20, 2007
  40. Alex RiesenMay 22, 2007
  41. Martin WaitzMay 24, 2007
  42. Steven GrimmMay 21, 2007
  43. Sven VerdoolaegeMay 21, 2007
  44. Alex RiesenMay 22, 2007
  45. Martin WaitzMay 20, 2007
  46. Alex RiesenMay 20, 2007
  47. Martin WaitzMay 20, 2007
  48. Martin WaitzMay 20, 2007
  49. Sven VerdoolaegeMay 21, 2007
  50. Martin WaitzMay 21, 2007
  51. Sven VerdoolaegeMay 21, 2007
  52. Martin WaitzMay 21, 2007
  53. Sven VerdoolaegeMay 21, 2007

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.