From: Ping Yin <pkufranky@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Ping Yin <pkufranky@gmail.com>
Subject: [PATCH v4 3/5] git-submodule summary: limit summary size
Date: Tue, 11 Mar 2008 01:54:15 +0800 [thread overview]
Message-ID: <1205171657-16216-3-git-send-email-pkufranky@gmail.com> (raw)
In-Reply-To: <1205171657-16216-2-git-send-email-pkufranky@gmail.com>
This patch teaches git-submodule an option '--summary-limit|-n <number>'
to limit number of commits in total for the summary of each submodule in
the modified case (only a single commit is shown in other cases).
Number 0 will disable summary and minus number means unlimted (the default).
Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
git-submodule.sh | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index c9afa06..e52e261 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -4,7 +4,9 @@
#
# Copyright (c) 2007 Lars Hjemli
-USAGE='[--quiet] [--cached] [add <repo> [-b branch]|status|init|update|summary [<commit>]] [--] [<path>...]'
+USAGE="[--quiet] [--cached] \
+[add <repo> [-b branch]|status|init|update|summary [-n|--summary-limit <n>] [<commit>]] \
+[--] [<path>...]"
OPTIONS_SPEC=
. git-sh-setup
require_work_tree
@@ -339,6 +341,8 @@ set_name_rev () {
# $@ = [commit (default 'HEAD'),] requested paths (default all)
#
cmd_summary() {
+ summary_limit=-1
+
# parse $args after "submodule ... summary".
while test $# -ne 0
do
@@ -346,6 +350,15 @@ cmd_summary() {
--cached)
cached="$1"
;;
+ -n|--summary-limit)
+ if summary_limit=$(($2 + 0)) 2>/dev/null && test "$summary_limit" = "$2"
+ then
+ :
+ else
+ usage
+ fi
+ shift
+ ;;
--)
shift
break
@@ -360,6 +373,8 @@ cmd_summary() {
shift
done
+ test $summary_limit = 0 && return
+
if rev=$(git rev-parse --verify "$1^0" 2>/dev/null)
then
head=$rev
@@ -462,8 +477,10 @@ cmd_summary() {
else
if test $mod_src = 160000 -a $mod_dst = 160000
then
+ limit=
+ test $summary_limit -gt 0 && limit="-$summary_limit"
GIT_DIR="$name/.git" \
- git log --pretty='format: %m %s' \
+ git log $limit --pretty='format: %m %s' \
--left-right --first-parent $sha1_src...$sha1_dst
elif test $mod_dst = 160000
then
--
1.5.4.3.347.g5314c
next prev parent reply other threads:[~2008-03-10 17:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-10 17:54 [PATCH v4 1/5] git-submodule summary: code framework Ping Yin
2008-03-10 17:54 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
2008-03-10 17:54 ` Ping Yin [this message]
2008-03-10 17:54 ` [PATCH v4 4/5] git-submodule summary: documentation Ping Yin
2008-03-10 17:54 ` [PATCH v4 5/5] git-submodule summary: test Ping Yin
2008-03-11 1:57 ` Ping Yin
2008-03-10 17:58 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
2008-03-11 1:52 ` Ping Yin
2008-03-11 7:28 ` Junio C Hamano
2008-03-11 9:37 ` Ping Yin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1205171657-16216-3-git-send-email-pkufranky@gmail.com \
--to=pkufranky@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).