summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2009-09-22 17:10:12 +0200
committerJunio C Hamano <gitster@pobox.com>2009-09-22 12:24:49 -0700
commit1414e5788b85787a712a30977b388200f1bc04da (patch)
tree883d7027fceed475781430ff2d57957d648ab136 /git-submodule.sh
parenta16753dc2e6f885fd30e570610c3e8cf355ecf04 (diff)
downloadgit-1414e5788b85787a712a30977b388200f1bc04da.tar.gz
git submodule add: make the <path> parameter optional
When <path> is not given, use the "humanish" part of the source repository instead. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index bfbd36b6f4..0c617eb40d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -5,7 +5,7 @@
# Copyright (c) 2007 Lars Hjemli
dashless=$(basename "$0" | sed -e 's/-/ /')
-USAGE="[--quiet] add [-b branch] [--reference <repository>] [--] <repository> <path>
+USAGE="[--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>]
or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: $dashless [--quiet] init [--] [<path>...]
or: $dashless [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
@@ -160,6 +160,11 @@ cmd_add()
repo=$1
path=$2
+ if test -z "$path"; then
+ path=$(echo "$repo" |
+ sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
+ fi
+
if test -z "$repo" -o -z "$path"; then
usage
fi