summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b303178)
raw | patch | inline | side by side (parent: b303178)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Fri, 16 May 2008 10:23:03 +0000 (11:23 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 May 2008 20:03:55 +0000 (13:03 -0700) |
When a submodule is not initialized and you do not want to change the
defaults from .gitmodules anyway, you can now say
$ git submodule update --init <name>
When "update" is called without --init on an uninitialized submodule,
a hint to use --init is printed.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
defaults from .gitmodules anyway, you can now say
$ git submodule update --init <name>
When "update" is called without --init on an uninitialized submodule,
a hint to use --init is printed.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-submodule.txt | patch | blob | history | |
git-submodule.sh | patch | blob | history | |
t/t7400-submodule-basic.sh | patch | blob | history |
index 6ffd896fbc78b783a7e00ed462f879cbff29d758..0668f295eee14facf0f9c4dd6ed2830cb6a348f8 100644 (file)
[verse]
'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>]
'git-submodule' [--quiet] status [--cached] [--] [<path>...]
-'git-submodule' [--quiet] [init|update] [--] [<path>...]
+'git-submodule' [--quiet] init [--] [<path>...]
+'git-submodule' [--quiet] update [--init] [--] [<path>...]
'git-submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
Update the registered submodules, i.e. clone missing submodules and
checkout the commit specified in the index of the containing repository.
This will make the submodules HEAD be detached.
++
+If the submodule is not yet initialized, and you just want to use the
+setting as stored in .gitmodules, you can automatically initialize the
+submodule with the --init option.
summary::
Show commit summary between the given commit (defaults to HEAD) and
diff --git a/git-submodule.sh b/git-submodule.sh
index b4b7d28d9d51c720443abcc1cac77e064e4b8696..100737210de3c76682ab3803626a36328fb27ca1 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
# Copyright (c) 2007 Lars Hjemli
USAGE="[--quiet] [--cached] \
-[add <repo> [-b branch]|status|init|update|summary [-n|--summary-limit <n>] [<commit>]] \
+[add <repo> [-b branch]|status|init|update [-i|--init]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]"
OPTIONS_SPEC=
. git-sh-setup
-q|--quiet)
quiet=1
;;
+ -i|--init)
+ shift
+ cmd_init "$@" || return
+ ;;
--)
shift
break
# path have been specified
test "$#" != "0" &&
say "Submodule path '$path' not initialized"
+ say "Maybe you want to use 'update --init'?"
continue
fi
index 2ef85a869d515b557815476f126386dc19f755c5..6c7b9024822024ca24f7d1ddea63c94d3aa016b0 100755 (executable)
test -z "$D"
'
+test_expect_success 'update --init' '
+
+ mv init init2 &&
+ git config -f .gitmodules submodule.example.url "$(pwd)/init2" &&
+ git config --remove-section submodule.example
+ git submodule update init > update.out &&
+ grep "not initialized" update.out &&
+ test ! -d init/.git &&
+ git submodule update --init init &&
+ test -d init/.git
+
+'
+
test_done