diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-04-19 21:11:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-19 21:11:29 -0700 |
commit | 3642617ee7359eed5e108fea48981841591142bf (patch) | |
tree | 79cc1c5fab5efa38ddd4a1fdfbb9e02f16d4ed78 /git-submodule.sh | |
parent | d52301630f05c95a9bd0205bc36289ce8bab9211 (diff) | |
parent | e5e4a7f23d7df0ec04b6423a90c9b858082a74af (diff) | |
download | git-3642617ee7359eed5e108fea48981841591142bf.tar.gz |
Merge branch 'py/submodule'
* py/submodule:
builtin-status: Add tests for submodule summary
builtin-status: submodule summary support
git-submodule summary: --for-status option
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index a745e42bf7..ce0f00c8a4 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -343,6 +343,7 @@ set_name_rev () { # cmd_summary() { summary_limit=-1 + for_status= # parse $args after "submodule ... summary". while test $# -ne 0 @@ -351,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 @@ -398,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- | @@ -500,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: |