Re: [PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ping Yin <pkufranky@xxxxxxxxx> 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
)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux