# [PATCH] status&commit: Teach them to show submodule commit summary

16 messages from 2007-11-12 to 2007-11-15. Participants: Ping Yin, Ralf Wildenhues, Jakub Narebski, Johannes Sixt, Johannes Schindelin, Brian Gernhardt, Lars Hjemli.
Thread: https://gitlist.dev/t/10829

## Ping Yin, 2007-11-12 14:21

Subject: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <1194877277-31777-1-git-send-email-pkufranky@gmail.com>
URL: https://gitlist.dev/e/1194877277-31777-1-git-send-email-pkufranky%40gmail.com

```
git status/commit just treats submodules as ordinary files when reporting status
changes. However, one may also wonder how submodules change (the commits).

This commit teaches git status/commit to additionally show commit summary of
user-cared (i.e. checked out) modified submodules since HEAD (or HEAD^ if
--amend option is on). For submodules deleted or initially added, commit summary
are not shown.

A configuration variable 'submodule.status' is used to turn this summary
behaviour on or off (default off). Also --submodule and --no-submodule options
are added.

By introducing this commit, git status will additionally give
'Submodules modified' section just before 'Untracked files' section as the
following example shows.

	# On branch master
	# Changes to be committed:
	#   (use "git reset HEAD <file>..." to unstage)
	#
	#	modified:   sm1
	#	modified:   sm2
	#	modified:   sm3
	#	deleted:    sm4
	#
	# Submodules modifiled: sm1 sm2 sm3
	#
	# * sm1 354cd45...3f751e5:
	#   <one line message for C
	#   <one line message for B
	#   >one line message for D
	#   >one line message for E
	#
	# * sm2 5c8bfb5...ac46d84:
	#   <msg
	#
	# * sm3 354cd45...3f751e5:
	#   Warn: sm3 doesn't contains commit 354cd45
	#
	# Untracked files:
	#   (use "git add <file>..." to include in what will be committed)
	#
	#	file1

This superproject shown has modified/deleted submodules sm1 to sm4.

sm1 has commit C in HEAD and commit E in index. The history of sm1 is
	--A-->B-->C (in HEAD:354cd45)
	  \
	   -->D-->E (in index:3f751e5)

The 'Submodules modified' section for sm1 shows how to change sm1 from commit C
(in HEAD) to commit E (in index): backward (<) to commit A first, and then
forward (>) to commit E.

Similar illustration for output of sm2 is omitted.

If the commit recorded in HEAD/index for a submodule is not found in the work
tree (say the submodule respository in the work tree), a warning will be issued.
Submodule sm3 falls into this case.

Commits of sm4 are not shown since it's a deleted submodule.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 Documentation/git-commit.txt |   10 +++++
 Documentation/git-status.txt |    3 +
 git-commit.sh                |   90 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index e54fb12..0680a57 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -139,6 +139,13 @@ but can be used to amend a merge commit.
 -q|--quiet::
 	Suppress commit summary message.
 
+--submodule|--no-submodule
+    Show/Don't show commit summary for user-cared (i.e. checked out)
+    modified submodules. Summaries for submodules deleted or initial
+    added are not shown. The bool configuration variable
+    'submodule.status' is used to control the default behaviour
+    (don't show by default).
+
 \--::
 	Do not interpret any more arguments as options.
 
@@ -259,6 +266,9 @@ GIT_EDITOR environment variable, the core.editor configuration variable, the
 VISUAL environment variable, or the EDITOR environment variable (in that
 order).
 
+The bool configuration variable 'submodule.status' is also honored to
+enable/disable the submodule summary behaviour (see option --submodule).
+
 HOOKS
 -----
 This command can run `commit-msg`, `pre-commit`, and
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 8fd0fc6..7afe6a0 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -49,6 +49,9 @@ mean the same thing and the latter is kept for backward
 compatibility) and `color.status.<slot>` configuration variables
 to colorize its output.
 
+The bool configuration variable 'submodule.status' is also honored
+to enable/disable the submodule summary behaviour (see option --submodule).
+
 See Also
 --------
 gitlink:gitignore[5]
diff --git a/git-commit.sh b/git-commit.sh
index fcb8443..813eb4e 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -33,6 +33,65 @@ save_index () {
 	cp -p "$THIS_INDEX" "$NEXT_INDEX"
 }
 
+# Show log of modified submodule (index modification since HEAD or $1)
+# $1 is the commit to be compared, default 'HEAD'
+show_module_log () {
+	cwd=$(pwd)
+	cd_to_toplevel
+
+	# get modified modules which have been checked out (i.e. cared by user)
+	modules=$(git diff --cached --name-only $1 |
+	(
+		IFS=''	# handle the module name containing space or tab
+		while read name
+		do
+			git ls-files --stage "$name" | grep '^160000 ' >&/dev/null &&
+			GIT_DIR="$name/.git" git-rev-parse --git-dir >&/dev/null &&
+			echo "$name"
+		done
+	)
+	)
+
+	# TODO: quote module names containing space or tab
+	test -n "$modules" && echo -e "# Submodules modifiled: "$modules"\n#"
+	OLDIFS=$IFS
+	IFS=$'\n\r'	# '\r' for mac os
+	for name in $modules
+	do
+		range=$(git diff --cached -- "$name" | sed -n '/^index.*160000$/ p' | awk '{print $2}')
+		indexone=${range#*..}
+		headone=${range%..*}
+		(
+			echo "* $name $headone...$indexone:"
+			headfail=
+			indexfail=
+			GIT_DIR="$name/.git" git-rev-parse $headone >&/dev/null || headfail='t'
+			GIT_DIR="$name/.git" git-rev-parse $indexone >&/dev/null || indexfail='t'
+			case "$headfail,$indexfail" in
+			t,)
+				echo "  Warn: $name doesn't contains commit $headone"
+				;;
+			,t)
+				echo "  Warn: $name doesn't contains commit $indexone"
+				;;
+			t,t)
+				echo "  Warn: $name doesn't contains commits $headone and $indexone"
+				;;
+			*)
+				left=$(GIT_DIR="$name/.git" git log --pretty=format:"  <%s" $indexone..$headone 2>&1)
+				right=$(GIT_DIR="$name/.git" git log --reverse --pretty=format:"  >%s" $headone..$indexone 2>&1) &&
+				test -n "$left" && echo "$left"
+				test -n "$right" && echo "$right"
+				;;
+			esac
+			echo
+		) | sed 's/^/# /'
+	done
+	IFS=$OLDIFS
+
+	cd "$cwd"
+}
+
 run_status () {
 	# If TMP_INDEX is defined, that means we are doing
 	# "--only" partial commit, and that index file is used
@@ -55,10 +114,25 @@ run_status () {
 	else
 		color=--nocolor
 	fi
-	git runstatus ${color} \
-		${verbose:+--verbose} \
-		${amend:+--amend} \
-		${untracked_files:+--untracked}
+	if test -n "$showsubmodule"
+	then
+		git runstatus ${color} \
+			${verbose:+--verbose} \
+			${amend:+--amend} \
+			${untracked_files:+--untracked} |
+		awk -v modulelog="$(show_module_log ${amend:+HEAD^})" '
+		/^# Untracked files:/ {shown=1; if (modulelog) print modulelog}
+		{print}
+		END {
+			if (!shown && modulelog) print modulelog
+		}
+		'
+	else
+		git runstatus ${color} \
+			${verbose:+--verbose} \
+			${amend:+--amend} \
+			${untracked_files:+--untracked}
+	fi
 }
 
 trap '
@@ -90,6 +164,8 @@ force_author=
 only_include_assumed=
 untracked_files=
 templatefile="`git config commit.template`"
+showsubmodule=$(git config --bool submodule.status 2>/dev/null)
+test "$showsubmodule" == "true" || showsubmodule=""
 while test $# != 0
 do
 	case "$1" in
@@ -230,6 +306,12 @@ do
 	--untracked-file|--untracked-files)
 		untracked_files=t
 		;;
+	--su|--sub|--subm|--submo|--submod|--submodu|--submodul|--submodule)
+		showsubmodule=t
+		;;
+	--no-su|--no-sub|--no-subm|--no-submo|--no-submod|--no-submodu|--no-submodul|--no-submodule)
+		showsubmodule=
+		;;
 	--)
 		shift
 		break
-- 
1.5.3.4

```

## Ralf Wildenhues, 2007-11-12 14:46

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <20071112144605.GA16791@ins.uni-bonn.de>
URL: https://gitlist.dev/e/20071112144605.GA16791%40ins.uni-bonn.de
In-Reply-To: <1194877277-31777-1-git-send-email-pkufranky@gmail.com>

```
Hello,

A couple of portability nits:

* Ping Yin wrote on Mon, Nov 12, 2007 at 03:21:17PM CET:
[...]
> +
> +	# TODO: quote module names containing space or tab
> +	test -n "$modules" && echo -e "# Submodules modifiled: "$modules"\n#"

Typo: s/modifiled/modified/

Then, "echo -e" is not portable (and not used elsewhere in git), but you
can just use this instead:
  test ... && { echo "# ..."; echo "#"; }

Also, it so happens you leave $modules outside quotes which will drop
multiple adjacent white spaces.  Did you mean to use
  echo "# Submodules modified: \"$modules\""
?

> +	OLDIFS=$IFS
> +	IFS=$'\n\r'	# '\r' for mac os

$' is not portable (and not POSIX either).  For example pdksh, OpenBSD
/bin/sh (which are both similar) will add "$" to the list of sepators
here, compare this: 

  $ foo=$'\n'; echo ".$foo."
  .$
  .

And at least some ash/dash versions will not interpret this as a newline
at all:
  .$\n.

You can instead just use a literal newline:
  IFS='
  '

(minus the indentation).  And add a literal carriage return if need be
(is that really needed on Mac OS?), though you may want to enclose that
in another pair of quotes to avoid it being "optimized" away by some
editor.

Cheers,
Ralf

```

## Ping Yin, 2007-11-12 15:17

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <46dff0320711120717gf8a67cdn2b6bdaa9cfa29218@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320711120717gf8a67cdn2b6bdaa9cfa29218%40mail.gmail.com
In-Reply-To: <20071112144605.GA16791@ins.uni-bonn.de>

```
On Nov 12, 2007 10:46 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> Hello,
>
> A couple of portability nits:
>
> * Ping Yin wrote on Mon, Nov 12, 2007 at 03:21:17PM CET:
> [...]
> > +
> > +     # TODO: quote module names containing space or tab
> > +     test -n "$modules" && echo -e "# Submodules modifiled: "$modules"\n#"
>
> Typo: s/modifiled/modified/
Oops
>
> Then, "echo -e" is not portable (and not used elsewhere in git), but you
> can just use this instead:
>   test ... && { echo "# ..."; echo "#"; }
See
>
> Also, it so happens you leave $modules outside quotes which will drop
> multiple adjacent white spaces.  Did you mean to use
>   echo "# Submodules modified: \"$modules\""
I leave $modules outside quotes to let "\n" change to <space> by auto
word splitting.
It actually eats white spaces in the module names. So any suggestion
to handle this case?
To handles module names with spaces, is it ok to display as follows?

Submodules modified: sm1 "sm name with space"

Any good way to only add quoting for names with spaces?

> You can instead just use a literal newline:
>   IFS='
>   '
> (minus the indentation).  And add a literal carriage return if need be
> (is that really needed on Mac OS?), though you may want to enclose that
> in another pair of quotes to avoid it being "optimized" away by some
> editor.
I just guess '\r' is need for Mac OS because i havn't Mac OS environment.
BTW, how to add a literal carriage return?
>
> Cheers,
> Ralf
>



-- 
Ping Yin

```

## Jakub Narebski, 2007-11-12 15:37

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <fh9rv5$g06$1@ger.gmane.org>
URL: https://gitlist.dev/e/fh9rv5%24g06%241%40ger.gmane.org
In-Reply-To: <1194877277-31777-1-git-send-email-pkufranky@gmail.com>

```
Ping Yin wrote:

> ---
>  Documentation/git-commit.txt |   10 +++++
>  Documentation/git-status.txt |    3 +
>  git-commit.sh                |   90 ++++++++++++++++++++++++++++++++++++++++--
>  3 files changed, 99 insertions(+), 4 deletions(-)

Shouldn't you also modify Documentation/config.txt ?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Ping Yin, 2007-11-12 15:46

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <46dff0320711120746s1258f31eh9bf676acedb10dc6@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320711120746s1258f31eh9bf676acedb10dc6%40mail.gmail.com
In-Reply-To: <fh9rv5$g06$1@ger.gmane.org>

```
On Nov 12, 2007 11:37 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> Ping Yin wrote:
>
> > ---
> > Documentation/git-commit.txt | 10 +++++
> > Documentation/git-status.txt | 3 +
> > git-commit.sh | 90 ++++++++++++++++++++++++++++++++++++++++--
> > 3 files changed, 99 insertions(+), 4 deletions(-)
>
> Shouldn't you also modify Documentation/config.txt ?
Oh, I'll supplement later
>
> --
> Jakub Narebski
> Warsaw, Poland
> ShadeHawk on #git
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Ping Yin

```

## Johannes Sixt, 2007-11-12 15:59

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <4738784F.7010106@viscovery.net>
URL: https://gitlist.dev/e/4738784F.7010106%40viscovery.net
In-Reply-To: <1194877277-31777-1-git-send-email-pkufranky@gmail.com>

```
Ping Yin schrieb:
> git status/commit just treats submodules as ordinary files when reporting status
> changes. However, one may also wonder how submodules change (the commits).
> 
> This commit teaches git status/commit to additionally show commit summary of
> user-cared (i.e. checked out) modified submodules since HEAD (or HEAD^ if
> --amend option is on). For submodules deleted or initially added, commit summary
> are not shown.

In general, I like the idea (as I've already pointed out).

But at this time git-commit is about to be made a builtin, and since your 
implementation contains a lot of non-portable constructs ($'', >&) and a new 
dependency on awk (and, hence, has little chances of being accepted), I 
suggest that you stay tuned, and implement this in the forth-coming 
builtin-commit.c.

> A configuration variable 'submodule.status' is used to turn this summary
> behaviour on or off (default off). Also --submodule and --no-submodule options
> are added.

There is already 'status.color', I suggest the configuration to become 
'status.submoduleSummary'.

-- Hannes

```

## Jakub Narebski, 2007-11-12 16:12

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <fh9u0i$n93$1@ger.gmane.org>
URL: https://gitlist.dev/e/fh9u0i%24n93%241%40ger.gmane.org
In-Reply-To: <4738784F.7010106@viscovery.net>

```
Johannes Sixt wrote:

>> A configuration variable 'submodule.status' is used to turn this summary
>> behaviour on or off (default off). Also --submodule and --no-submodule options
>> are added.
> 
> There is already 'status.color', I suggest the configuration to become 
> 'status.submoduleSummary'.

Or status.submodule.summary, although we usually use
section.<variable_sub>.key configuration variables,
e.g. branch.<name>.remote. But we have exception:
color.branch.<slot>

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Johannes Schindelin, 2007-11-12 16:13

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <Pine.LNX.4.64.0711121612250.4362@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711121612250.4362%40racer.site
In-Reply-To: <4738784F.7010106@viscovery.net>

```
Hi,

On Mon, 12 Nov 2007, Johannes Sixt wrote:

> Ping Yin schrieb:
> > git status/commit just treats submodules as ordinary files when 
> > reporting status changes. However, one may also wonder how submodules 
> > change (the commits).
> > 
> > This commit teaches git status/commit to additionally show commit 
> > summary of user-cared (i.e. checked out) modified submodules since 
> > HEAD (or HEAD^ if --amend option is on). For submodules deleted or 
> > initially added, commit summary are not shown.
> 
> In general, I like the idea (as I've already pointed out).
> 
> But at this time git-commit is about to be made a builtin, and since 
> your implementation contains a lot of non-portable constructs ($'', >&) 
> and a new dependency on awk (and, hence, has little chances of being 
> accepted), I suggest that you stay tuned, and implement this in the 
> forth-coming builtin-commit.c.

I agree.

> > A configuration variable 'submodule.status' is used to turn this 
> > summary behaviour on or off (default off). Also --submodule and 
> > --no-submodule options are added.
> 
> There is already 'status.color', I suggest the configuration to become 
> 'status.submoduleSummary'.

You could make this variable even a numeric one.  Saying how many lines 
you want to have maximally (-1 meaning unlimited).

Ciao,
Dscho

```

## Ping Yin, 2007-11-12 16:35

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <46dff0320711120835h31166370k64e9c92e9cf3432c@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320711120835h31166370k64e9c92e9cf3432c%40mail.gmail.com
In-Reply-To: <4738784F.7010106@viscovery.net>

```
On Nov 12, 2007 11:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:

> But at this time git-commit is about to be made a builtin, and since your
> implementation contains a lot of non-portable constructs ($'', >&) and a new
> dependency on awk (and, hence, has little chances of being accepted), I
> suggest that you stay tuned, and implement this in the forth-coming
> builtin-commit.c.
Implement this in shell scripts is just a piece of cake, but not so
easy in builtin-commit.c. Not to mention that i'm unamiliar with git c
code. $', >& portable problem can be easily corrected. However, awk is
a new dependency? I have seen it in git-mergetool.sh
>
> > A configuration variable 'submodule.status' is used to turn this summary
> > behaviour on or off (default off). Also --submodule and --no-submodule options
> > are added.
>
> There is already 'status.color', I suggest the configuration to become
> 'status.submoduleSummary'.
There is 'status.color', but 'color.status' is prefered as said in the
documentation. So i follows this rule, name the variable submodule.*
just as the ones for git-submodule. I think it's a good idea to put
all submodule related configuration variables in the submodule.*
namespaces.

>
> -- Hannes
>
>



-- 
Ping Yin

```

## Ping Yin, 2007-11-12 16:39

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <46dff0320711120839q7fc0542frd90a396237c144bf@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320711120839q7fc0542frd90a396237c144bf%40mail.gmail.com
In-Reply-To: <Pine.LNX.4.64.0711121612250.4362@racer.site>

```
On Nov 13, 2007 12:13 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:

> >
> > There is already 'status.color', I suggest the configuration to become
> > 'status.submoduleSummary'.
>
> You could make this variable even a numeric one.  Saying how many lines
> you want to have maximally (-1 meaning unlimited).
Good idea.
However, there is a problem about limiting the lines of commit
summary: if there are 50 backwards and 50 forwards, and summary lines
are limited to 50 lines. How to display? 25 backwards, 25 forwards or
only 50 backwards?
>
> Ciao,
> Dscho
>
>



-- 
Ping Yin

```

## Ping Yin, 2007-11-12 16:42

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <46dff0320711120842s40441614n82343bc75057201e@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320711120842s40441614n82343bc75057201e%40mail.gmail.com
In-Reply-To: <fh9u0i$n93$1@ger.gmane.org>

```
On Nov 13, 2007 12:12 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> Johannes Sixt wrote:
>
> >> A configuration variable 'submodule.status' is used to turn this summary
> >> behaviour on or off (default off). Also --submodule and --no-submodule options
> >> are added.
> >
> > There is already 'status.color', I suggest the configuration to become
> > 'status.submoduleSummary'.
>
> Or status.submodule.summary, although we usually use
> section.<variable_sub>.key configuration variables,
> e.g. branch.<name>.remote. But we have exception:
> color.branch.<slot>

maybe submodule.status.summary better?
later new variables can be added easily such as
submodule.status.recursive, submodule.diff, submodule.log
>
> --
>
> Jakub Narebski
> Warsaw, Poland
> ShadeHawk on #git
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Ping Yin

```

## Johannes Sixt, 2007-11-12 16:45

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <47388344.6010008@viscovery.net>
URL: https://gitlist.dev/e/47388344.6010008%40viscovery.net
In-Reply-To: <46dff0320711120835h31166370k64e9c92e9cf3432c@mail.gmail.com>

```
Ping Yin schrieb:
> On Nov 12, 2007 11:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> 
>> But at this time git-commit is about to be made a builtin, and since your
>> implementation contains a lot of non-portable constructs ($'', >&) and a new
>> dependency on awk (and, hence, has little chances of being accepted), I
>> suggest that you stay tuned, and implement this in the forth-coming
>> builtin-commit.c.
> Implement this in shell scripts is just a piece of cake, but not so
> easy in builtin-commit.c.

I'm with you. But git-commit.sh is a dead horse, no matter how hard you beat it.

BTW, maybe you can keep the log generation in a helper script, 
git-status--submodulesummary, and invoke that from builtin-commit.c. This 
way you get both: integration and ease of implementation.

>>> A configuration variable 'submodule.status' is used to turn this summary
>>> behaviour on or off (default off). Also --submodule and --no-submodule options
>>> are added.
>> There is already 'status.color', I suggest the configuration to become
>> 'status.submoduleSummary'.
> There is 'status.color', but 'color.status' is prefered as said in the
> documentation. So i follows this rule, name the variable submodule.*
> just as the ones for git-submodule. I think it's a good idea to put
> all submodule related configuration variables in the submodule.*
> namespaces.

"I think it's a good idea to put all status related configuration variables 
in the status.* namespace."

But I don't care too deeply. I don't have the big picture about which 
configuration variables namespaces exist and which one to pick in this case.

-- Hannes

```

## Johannes Sixt, 2007-11-12 16:51

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <4738848B.8020403@viscovery.net>
URL: https://gitlist.dev/e/4738848B.8020403%40viscovery.net
In-Reply-To: <46dff0320711120839q7fc0542frd90a396237c144bf@mail.gmail.com>

```
Ping Yin schrieb:
> On Nov 13, 2007 12:13 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> 
>>> There is already 'status.color', I suggest the configuration to become
>>> 'status.submoduleSummary'.
>> You could make this variable even a numeric one.  Saying how many lines
>> you want to have maximally (-1 meaning unlimited).
> Good idea.
> However, there is a problem about limiting the lines of commit
> summary: if there are 50 backwards and 50 forwards, and summary lines
> are limited to 50 lines. How to display? 25 backwards, 25 forwards or
> only 50 backwards?

Just use git log --left-right --topo-order, then you can easily insert -$n, 
and git-log will decide where it cuts off the lists.

However, --left-right won't reverse one of the list, like you did.

-- Hannes

```

## Brian Gernhardt, 2007-11-12 16:53

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <BB55CC0E-DD0C-4870-8806-B037DE159051@silverinsanity.com>
URL: https://gitlist.dev/e/BB55CC0E-DD0C-4870-8806-B037DE159051%40silverinsanity.com
In-Reply-To: <46dff0320711120717gf8a67cdn2b6bdaa9cfa29218@mail.gmail.com>

```

On Nov 12, 2007, at 10:17 AM, Ping Yin wrote:

> I just guess '\r' is need for Mac OS because i havn't Mac OS  
> environment.
> BTW, how to add a literal carriage return?

OS X's command line environment is modeled after BSD and uses the nice  
and sane \n as a line ending.  And since earlier Mac OS versions (that  
did use \r) don't have a command line, I don't see people using git on  
them.

~~ Brian

```

## Lars Hjemli, 2007-11-12 17:47

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <8c5c35580711120947s246f192coa3796ac6541a28d7@mail.gmail.com>
URL: https://gitlist.dev/e/8c5c35580711120947s246f192coa3796ac6541a28d7%40mail.gmail.com
In-Reply-To: <47388344.6010008@viscovery.net>

```
On Nov 12, 2007 5:45 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Ping Yin schrieb:
> > On Nov 12, 2007 11:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> >
> >> But at this time git-commit is about to be made a builtin, and since your
> >> implementation contains a lot of non-portable constructs ($'', >&) and a new
> >> dependency on awk (and, hence, has little chances of being accepted), I
> >> suggest that you stay tuned, and implement this in the forth-coming
> >> builtin-commit.c.
> > Implement this in shell scripts is just a piece of cake, but not so
> > easy in builtin-commit.c.
>
> I'm with you. But git-commit.sh is a dead horse, no matter how hard you beat it.
>
> BTW, maybe you can keep the log generation in a helper script,
> git-status--submodulesummary, and invoke that from builtin-commit.c. This
> way you get both: integration and ease of implementation.

Sorry for repeating myself, but IMVHO this belong in git-submodule.sh:
It can be useful as a standalone command, we get all submodule-related
commands isolated in a single place, and builtin-commit.c can of
course exec git-submodule to get the summary.

--
larsh

```

## Ping Yin, 2007-11-15 16:49

Subject: Re: [PATCH] status&commit: Teach them to show submodule commit summary
Message-ID: <46dff0320711150849l5b7dc6a3y6b625e45a3117d4f@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320711150849l5b7dc6a3y6b625e45a3117d4f%40mail.gmail.com
In-Reply-To: <8c5c35580711120947s246f192coa3796ac6541a28d7@mail.gmail.com>

```
On Nov 13, 2007 1:47 AM, Lars Hjemli <hjemli@gmail.com> wrote:
> On Nov 12, 2007 5:45 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> > Ping Yin schrieb:
> > > On Nov 12, 2007 11:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> > >
> > >> But at this time git-commit is about to be made a builtin, and since your
> > >> implementation contains a lot of non-portable constructs ($'', >&) and a new
> > >> dependency on awk (and, hence, has little chances of being accepted), I
> > >> suggest that you stay tuned, and implement this in the forth-coming
> > >> builtin-commit.c.
> > > Implement this in shell scripts is just a piece of cake, but not so
> > > easy in builtin-commit.c.
> >
> > I'm with you. But git-commit.sh is a dead horse, no matter how hard you beat it.
> >
> > BTW, maybe you can keep the log generation in a helper script,
> > git-status--submodulesummary, and invoke that from builtin-commit.c. This
> > way you get both: integration and ease of implementation.
>
> Sorry for repeating myself, but IMVHO this belong in git-submodule.sh:
> It can be useful as a standalone command, we get all submodule-related
> commands isolated in a single place, and builtin-commit.c can of
> course exec git-submodule to get the summary.
>
OK. I'll reconsider it and reimplement it when i have time.



-- 
Ping Yin

```
