summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f43e2fd)
raw | patch | inline | side by side (parent: f43e2fd)
author | Ping Yin <pkufranky@gmail.com> | |
Sat, 12 Apr 2008 15:05:31 +0000 (23:05 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Apr 2008 03:00:45 +0000 (20:00 -0700) |
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>
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>
git-submodule.sh | patch | blob | history | |
t/t7401-submodule-summary.sh | patch | blob | history |
diff --git a/git-submodule.sh b/git-submodule.sh
index 7674346c8d9525b0d8928f48354bdbe0af8b8e23..3249042028fbc6f2376c500711e661d521c147d1 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
#
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:
index b9a22190e86a0b8718b215771352ecefbdf86edc..bf12dbdeef6e307850a91eb6be5ebe537b2de0c8 100755 (executable)
EOF
"
+test_expect_success '--for-status' "
+ git submodule summary --for-status HEAD^ >actual &&
+ test_cmp actual - <<EOF
+# Modified submodules:
+#
+# * sm1 $head6...0000000:
+#
+# * sm2 0000000...$head7 (2):
+# > Add foo9
+#
+EOF
+"
+
test_done