diff options
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index 7674346c8d..67f7a28cb3 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -300,7 +300,7 @@ cmd_update() continue fi - if ! test -d "$path"/.git + if ! test -d "$path"/.git -o -f "$path"/.git then module_clone "$path" "$url" || exit subsha1= @@ -327,7 +327,8 @@ set_name_rev () { cd "$1" && { git describe "$2" 2>/dev/null || git describe --tags "$2" 2>/dev/null || - git describe --contains --tags --always "$2" + git describe --contains "$2" 2>/dev/null || + git describe --all --always "$2" } ) ) test -z "$revname" || revname=" ($revname)" @@ -342,6 +343,7 @@ set_name_rev () { # cmd_summary() { summary_limit=-1 + for_status= # parse $args after "submodule ... summary". while test $# -ne 0 @@ -350,6 +352,9 @@ cmd_summary() { --cached) cached="$1" ;; + --for-status) + for_status="$1" + ;; -n|--summary-limit) if summary_limit=$(($2 + 0)) 2>/dev/null && test "$summary_limit" = "$2" then @@ -397,7 +402,8 @@ cmd_summary() { done ) - test -n "$modules" && + test -z "$modules" && return + git diff-index $cached --raw $head -- $modules | grep -e '^:160000' -e '^:[0-7]* 160000' | cut -c2- | @@ -499,7 +505,14 @@ cmd_summary() { echo fi echo - done + done | + if test -n "$for_status"; then + echo "# Modified submodules:" + echo "#" + sed -e 's|^|# |' -e 's|^# $|#|' + else + cat + fi } # # List all submodules, prefixed with: @@ -542,7 +555,7 @@ cmd_status() do name=$(module_name "$path") || exit url=$(git config submodule."$name".url) - if test -z "$url" || ! test -d "$path"/.git + if test -z "$url" || ! test -d "$path"/.git -o -f "$path"/.git then say "-$sha1 $path" continue; |