Merge branch 'py/submodule'
authorJunio C Hamano <gitster@pobox.com>
Sun, 20 Apr 2008 04:11:29 +0000 (21:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 20 Apr 2008 04:11:29 +0000 (21:11 -0700)
* py/submodule:
builtin-status: Add tests for submodule summary
builtin-status: submodule summary support
git-submodule summary: --for-status option

1  2 
git-submodule.sh
diff --combined git-submodule.sh
index a745e42bf7b19d6b813ff8e1e60e8b0ba41aaa14,3249042028fbc6f2376c500711e661d521c147d1..ce0f00c8a4f6d5f9a2c1c3ebdbadff52106b60d0
@@@ -327,8 -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)"
  #
  cmd_summary() {
        summary_limit=-1
+       for_status=
  
        # parse $args after "submodule ... summary".
        while test $# -ne 0
                --cached)
                        cached="$1"
                        ;;
+               --for-status)
+                       for_status="$1"
+                       ;;
                -n|--summary-limit)
                        if summary_limit=$(($2 + 0)) 2>/dev/null && test "$summary_limit" = "$2"
                        then
                done
        )
  
-       test -n "$modules" &&
+       test -z "$modules" && return
        git diff-index $cached --raw $head -- $modules |
        grep -e '^:160000' -e '^:[0-7]* 160000' |
        cut -c2- |
                        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: