diff options
author | Ping Yin <pkufranky@gmail.com> | 2008-04-12 23:05:31 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-12 20:00:45 -0700 |
commit | d0f64dd44d5f708f77380998b2c16bffe1e94050 (patch) | |
tree | 55456f9485f192f9b616ea7b4c86bc6a8fde0755 /git-submodule.sh | |
parent | f43e2fd43b50d5a82a34bb3e4f848cb38bf93b7f (diff) | |
download | git-d0f64dd44d5f708f77380998b2c16bffe1e94050.tar.gz |
git-submodule summary: --for-status option
The --for-status option is mainly used by builtin-status/commit.
It adds 'Modified submodules:' line at top and '# ' prefix to all
following lines.
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 7674346c8d..3249042028 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -342,6 +342,7 @@ set_name_rev () { # cmd_summary() { summary_limit=-1 + for_status= # parse $args after "submodule ... summary". while test $# -ne 0 @@ -350,6 +351,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 +401,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 +504,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: |