summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-21 07:46:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-21 07:46:07 (GMT)
commit6a09ff14fb1df8f05f4a800fca6e2d9d670445bd (patch)
tree61fadb8d09e3daae125ca15a9024486d7cd9da85 /git-submodule.sh
parent3fa95ce52bdfa2b99b76d64949884413c04ad3cb (diff)
parent1414e5788b85787a712a30977b388200f1bc04da (diff)
downloadgit-6a09ff14fb1df8f05f4a800fca6e2d9d670445bd.zip
git-6a09ff14fb1df8f05f4a800fca6e2d9d670445bd.tar.gz
git-6a09ff14fb1df8f05f4a800fca6e2d9d670445bd.tar.bz2
Merge branch 'jl/submodule-add-noname'
* jl/submodule-add-noname: git submodule add: make the <path> parameter optional
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 0462e52..850d423 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