Merge branch 'jl/submodule-add-noname'
authorJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 07:46:07 +0000 (23:46 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 07:46:07 +0000 (23:46 -0800)
* jl/submodule-add-noname:
git submodule add: make the <path> parameter optional

1  2 
git-submodule.sh
diff --combined git-submodule.sh
index 0462e529d934750fb63a5a897f135d60ac674b5e,0c617eb40d4d7d3902c0562e9ace982f7cf98fa4..850d4235a003a9934681b319199e82da07a865dd
@@@ -5,7 -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>...]
@@@ -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