From: Junio C Hamano Date: Sat, 21 Nov 2009 07:46:07 +0000 (-0800) Subject: Merge branch 'jl/submodule-add-noname' X-Git-Tag: v1.6.6-rc0~30 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6a09ff14fb1df8f05f4a800fca6e2d9d670445bd?ds=sidebyside;hp=-c Merge branch 'jl/submodule-add-noname' * jl/submodule-add-noname: git submodule add: make the parameter optional --- 6a09ff14fb1df8f05f4a800fca6e2d9d670445bd diff --combined git-submodule.sh index 0462e529d9,0c617eb40d..850d4235a0 --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -5,7 -5,7 +5,7 @@@ # Copyright (c) 2007 Lars Hjemli dashless=$(basename "$0" | sed -e 's/-/ /') - USAGE="[--quiet] add [-b branch] [--reference ] [--] + USAGE="[--quiet] add [-b branch] [--reference ] [--] [] or: $dashless [--quiet] status [--cached] [--recursive] [--] [...] or: $dashless [--quiet] init [--] [...] or: $dashless [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference ] [--merge] [--recursive] [--] [...] @@@ -98,7 -98,7 +98,7 @@@ module_clone( if test -d "$path" then rmdir "$path" 2>/dev/null || - die "Directory '$path' exist, but is neither empty nor a git repository" + die "Directory '$path' exists, but is neither empty nor a git repository" fi test -e "$path" && @@@ -160,6 -160,11 +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