git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ping Yin <pkufranky@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size
Date: Wed, 05 Mar 2008 16:24:18 -0800	[thread overview]
Message-ID: <7v7iggitsd.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1204481710-29791-3-git-send-email-pkufranky@gmail.com> (Ping Yin's message of "Mon, 3 Mar 2008 02:15:09 +0800")

Ping Yin <pkufranky@gmail.com> writes:

> This patch teaches git-submodule an option '--summary-limit|-n <number>'
> to limit number of commits in total for the summary. Number 0 will disable
> summary and minus number means unlimted (the default).

I really doubt showing the bottom one specially makes sense.

Why not just read from

	git log '--pretty=%m %h %s' --left-right --topo-order A...B

and show N top commits from each?

I've already said that I do not think applying the same limit to
new/deleted/modified cases makes sense, so commenting on this
part might be a moot point, though.

-- >8 --

#!/bin/sh

limit=10
A=cc/run-command
B=jc/test

lf='
'
git log --pretty=format:%m\ %h\ %s --left-right $A...$B |
(
	left=0 right=0 l= r= llast= rlast=
	ilimit=$(( $limit - 1 ))
	while read leftright commit name
	do
		it="$leftright$commit $name"
		case "$leftright" in
		'<')
			if test $left -eq $ilimit
			then
				llast=$it
			elif test $left -le $ilimit
			then
				l="$l$it$lf"
			fi
			left=$(( $left + 1 ))
			;;
		'>')
			if test $right -eq $ilimit
			then
				rlast=$it
			elif test $right -le $ilimit
			then
				r="$r$it$lf"
			fi
			right=$(( $right + 1 ))
			;;
		esac
	done

	printf %s "$l"
	if test $left -eq $limit
	then
		echo "$llast"
	elif test $left -gt $limit
	then
		echo "< ("$(( $left - $limit ))" more...)"
	fi
	printf %s "$r"
	if test $right -eq $limit
	then
		echo "$rlast"
	elif test $right -gt $limit
	then
		echo "> ("$(( $right - $limit ))" more...)"
	fi
)

  reply	other threads:[~2008-03-06  0:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02 18:15 [PATCH v3 1/4] git-submodule: New subcommand 'summary' (1) - code framework Ping Yin
2008-03-02 18:15 ` [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary Ping Yin
2008-03-05 23:57   ` Junio C Hamano
2008-03-06  2:16     ` Ping Yin
2008-03-06  4:10       ` Junio C Hamano
2008-03-06  5:56         ` Ping Yin
2008-03-06 10:42           ` Junio C Hamano
2008-03-06 11:36             ` Ping Yin
2008-03-02 18:15 ` [PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size Ping Yin
2008-03-06  0:24   ` Junio C Hamano [this message]
2008-03-06  2:24     ` Ping Yin
2008-03-07  1:50       ` Ping Yin
2008-03-02 18:15 ` [PATCH v3 4/4] git-submodule: New subcommand 'summary' (4) - Update the document 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=7v7iggitsd.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pkufranky@gmail.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).