git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/5] git-submodule summary: code framework
@ 2008-03-10 17:54 Ping Yin
  2008-03-10 17:54 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
  0 siblings, 1 reply; 10+ messages in thread
From: Ping Yin @ 2008-03-10 17:54 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

Following patches will teach git-submodule a new subcommand 'summary' to
show commit summary of user-cared (i.e. checked out) submodules between
a given super project commit (default to HEAD) and working tree
(or index, switched by --cached).

This patch just introduces the framework and find submodules which has
summary to show. A submodule will have summary if it fits into any one of
following cases.

  - type 'M': modified and checked out    (1)
  - type 'A': added and checked out       (2)
  - type 'D': deleted
  - type 'T': typechanged (blob <-> submodule)

Note:
  1. There may be modified but not checked out cases. In the case of a
     merge conflict, even if the submodule is not checked out, there may
	 be still a diff between index and HEAD on the submodule entry
	 (i.e. modified). The summary will not be show for such a submodule.
  2. A similar explanation applies to the added but not checked out case.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 git-submodule.sh |   61 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 7171cb6..b70ae40 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 2007 Lars Hjemli
 
-USAGE='[--quiet] [--cached] [add <repo> [-b branch]|status|init|update] [--] [<path>...]'
+USAGE='[--quiet] [--cached] [add <repo> [-b branch]|status|init|update|summary [<commit>]] [--] [<path>...]'
 OPTIONS_SPEC=
 . git-sh-setup
 require_work_tree
@@ -330,7 +330,58 @@ set_name_rev () {
 	) )
 	test -z "$revname" || revname=" ($revname)"
 }
+#
+# Show commit summary for submodules in index or working tree
+#
+# If '--cached' is given, show summary between index and given commit,
+# or between working tree and given commit
+#
+# $@ = [commit (default 'HEAD'),] requested paths (default all)
+#
+cmd_summary() {
+	# parse $args after "submodule ... summary".
+	while test $# -ne 0
+	do
+		case "$1" in
+		--cached)
+			cached="$1"
+			;;
+		--)
+			shift
+			break
+			;;
+		-*)
+			usage
+			;;
+		*)
+			break
+			;;
+		esac
+		shift
+	done
 
+	if rev=$(git rev-parse --verify "$1^0" 2>/dev/null)
+	then
+		head=$rev
+		shift
+	else
+		head=HEAD
+	fi
+
+	cd_to_toplevel
+	# Get modified modules cared by user
+	modules=$(git diff-index $cached --raw $head -- "$@" |
+		grep -e '^:160000' -e '^:[0-7]* 160000' |
+		while read mod_src mod_dst sha1_src sha1_dst status name
+		do
+			# Always show modules deleted or type-changed (blob<->module)
+			test $status = D -o $status = T && echo "$name" && continue
+			# Also show added or modified modules which are checked out
+			GIT_DIR="$name/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
+			echo "$name"
+		done
+	)
+}
 #
 # List all submodules, prefixed with:
 #  - submodule not initialized
@@ -401,7 +452,7 @@ cmd_status()
 while test $# != 0 && test -z "$command"
 do
 	case "$1" in
-	add | init | update | status)
+	add | init | update | status | summary)
 		command=$1
 		;;
 	-q|--quiet)
@@ -416,7 +467,7 @@ do
 		branch="$2"; shift
 		;;
 	--cached)
-		cached=1
+		cached="$1"
 		;;
 	--)
 		break
@@ -440,8 +491,8 @@ then
 	usage
 fi
 
-# "--cached" is accepted only by "status"
-if test -n "$cached" && test "$command" != status
+# "--cached" is accepted only by "status" and "summary"
+if test -n "$cached" && test "$command" != status -a "$command" != summary
 then
 	usage
 fi
-- 
1.5.4.3.347.g5314c

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/5] git-submodule summary: show commit summary
  2008-03-10 17:54 [PATCH v4 1/5] git-submodule summary: code framework Ping Yin
@ 2008-03-10 17:54 ` Ping Yin
  2008-03-10 17:54   ` [PATCH v4 3/5] git-submodule summary: limit summary size Ping Yin
                     ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Ping Yin @ 2008-03-10 17:54 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

This patch does the hard work to show submodule commit summary.

For a modified submodule, a series of commits will be shown with
the following command

	git log --pretty='format:%m %s' --left-right \
	--first-parent sha1_src...sha1_dst

where the src sha1 is from the given super project commit and the
dst sha1 is from the index or working tree (switched by --cached).

For a deleted, added, or typechanged (blob<->submodule) submodule,
only one single newest commit from the existing end (for example,
src end for submodule deleted or type changed from submodule to blob)
will be shown.

If the src/dst sha1 for a submodule is missing in the submodule
directory, a warning will be issued except in two cases where the
submodule directory is deleted (type 'D') or typechanged to blob
(one case of type 'T').

In the title line for a submodule, the src/dst sha1 and the number
of commits (--first-parent) between the two sha1s will be shown.

The following example demonstrates most cases.

Example: commit summary for modified submodules sm1-sm5.
--------------------------------------------
$ git submodule summary
* sm1 354cd45...3f751e5 (4):
  < one line message for C
  < one line message for B
  > one line message for D
  > one line message for E

* sm2 5c8bfb5...000000 (3):
  < one line message for F

* sm3 354cd45...3f751e5:
  Warn: sm3 doesn't contain commit 354cd45

* sm4 354cd34(submodule)-> 235efa(blob) (1):
  < one line message for G

* sm5 354cd34(blob)-> 235efa(submodule) (5):
  > one line message for H

--------------------------------------------

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 git-submodule.sh |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index b70ae40..c9afa06 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -381,6 +381,102 @@ cmd_summary() {
 			echo "$name"
 		done
 	)
+
+	test -n "$modules" &&
+	git diff-index $cached --raw $head -- $modules |
+	grep -e '^:160000' -e '^:[0-7]* 160000' |
+	cut -c2- |
+	while read mod_src mod_dst sha1_src sha1_dst status name
+	do
+		if test -z "$cached" &&
+			test $sha1_dst = 0000000000000000000000000000000000000000
+		then
+			case "$mod_dst" in
+				160000)
+				sha1_dst=$(GIT_DIR="$name/.git" git rev-parse HEAD)
+				;;
+				100644)
+				sha1_dst=$(git hash-object $name)
+				;;
+			esac
+		fi
+		missing_src=
+		missing_dst=
+
+		test $mod_src = 160000 &&
+		! GIT_DIR="$name/.git" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 &&
+		missing_src=t
+
+		test $mod_dst = 160000 &&
+		! GIT_DIR="$name/.git" git-rev-parse --verify $sha1_dst^0 >/dev/null 2>&1 &&
+		missing_dst=t
+
+		total_commits=
+		case "$missing_src,$missing_dst" in
+		t,)
+			errmsg="  Warn: $name doesn't contain commit $sha1_src"
+			;;
+		,t)
+			errmsg="  Warn: $name doesn't contain commit $sha1_dst"
+			;;
+		t,t)
+			errmsg="  Warn: $name doesn't contain commits $sha1_src and $sha1_dst"
+			;;
+		*)
+			errmsg=
+			total_commits=$(
+			if test $mod_src = 160000 -a $mod_dst = 160000
+			then
+				range="$sha1_src...$sha1_dst"
+			elif test $mod_src = 160000
+			then
+				range=$sha1_src
+			else
+				range=$sha1_dst
+			fi
+			GIT_DIR="$name/.git" \
+			git log --pretty=oneline --first-parent $range | wc -l
+			)
+			total_commits=" ($total_commits)"
+			;;
+		esac
+
+		sha1_abbr_src=$(echo $sha1_src | cut -c1-7)
+		sha1_abbr_dst=$(echo $sha1_dst | cut -c1-7)
+		if test $status = T
+		then
+			if test $mod_dst = 160000
+			then
+				echo "* $name $sha1_abbr_src(blob)->$sha1_abbr_dst(submodule)$total_commits:"
+			else
+				echo "* $name $sha1_abbr_src(submodule)->$sha1_abbr_dst(blob)$total_commits:"
+			fi
+		else
+			echo "* $name $sha1_abbr_src...$sha1_abbr_dst$total_commits:"
+		fi
+		if test -n "$errmsg"
+		then
+			# Don't give error msg for modification whose dst is not submodule
+			# i.e. deleted or changed to blob
+			test $mod_dst = 160000 && echo "$errmsg"
+		else
+			if test $mod_src = 160000 -a $mod_dst = 160000
+			then
+				GIT_DIR="$name/.git" \
+				git log --pretty='format:  %m %s' \
+				--left-right --first-parent $sha1_src...$sha1_dst
+			elif test $mod_dst = 160000
+			then
+				GIT_DIR="$name/.git" \
+				git log --pretty='format:  > %s' -1 $sha1_dst
+			else
+				GIT_DIR="$name/.git" \
+				git log --pretty='format:  < %s' -1 $sha1_src
+			fi
+			echo
+		fi
+		echo
+	done
 }
 #
 # List all submodules, prefixed with:
-- 
1.5.4.3.347.g5314c

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 3/5] git-submodule summary: limit summary size
  2008-03-10 17:54 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
@ 2008-03-10 17:54   ` Ping Yin
  2008-03-10 17:54     ` [PATCH v4 4/5] git-submodule summary: documentation Ping Yin
  2008-03-10 17:58   ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Ping Yin @ 2008-03-10 17:54 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 4/5] git-submodule summary: documentation
  2008-03-10 17:54   ` [PATCH v4 3/5] git-submodule summary: limit summary size Ping Yin
@ 2008-03-10 17:54     ` Ping Yin
  2008-03-10 17:54       ` [PATCH v4 5/5] git-submodule summary: test Ping Yin
  0 siblings, 1 reply; 10+ messages in thread
From: Ping Yin @ 2008-03-10 17:54 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 Documentation/git-submodule.txt |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index b4d0160..41f9f63 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -12,6 +12,7 @@ SYNOPSIS
 'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>]
 'git-submodule' [--quiet] status [--cached] [--] [<path>...]
 'git-submodule' [--quiet] [init|update] [--] [<path>...]
+'git-submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
 
 
 COMMANDS
@@ -47,6 +48,11 @@ update::
 	checkout the commit specified in the index of the containing repository.
 	This will make the submodules HEAD be detached.
 
+summary::
+	Show commit summary between the given commit (defaults to HEAD) and
+	working tree/index. For a submodule in question, a series of commits
+	in the submodule between the given super project commit and the
+	index or working tree (switched by --cached) are shown.
 
 OPTIONS
 -------
@@ -57,9 +63,16 @@ OPTIONS
 	Branch of repository to add as submodule.
 
 --cached::
-	Display the SHA-1 stored in the index, not the SHA-1 of the currently
-	checked out submodule commit. This option is only valid for the
-	status command.
+	This option is only valid for status and summary commands.  These
+	commands typically use the commit found in the submodule HEAD, but
+	with this option, the commit stored in the index is used instead.
+
+-n, --summary-limit::
+	This option is only valid for the summary command.
+	Limit the summary size (number of commits shown in total).
+	Giving 0 will disable the summary; a negative number means unlimted
+	(the default). This limit only applies to modified submodules. The
+	size is always limited to 1 for added/deleted/typechanged submodules.
 
 <path>::
 	Path to submodule(s). When specified this will restrict the command
-- 
1.5.4.3.347.g5314c

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 5/5] git-submodule summary: test
  2008-03-10 17:54     ` [PATCH v4 4/5] git-submodule summary: documentation Ping Yin
@ 2008-03-10 17:54       ` Ping Yin
  2008-03-11  1:57         ` Ping Yin
  0 siblings, 1 reply; 10+ messages in thread
From: Ping Yin @ 2008-03-10 17:54 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 t/t7401-submodule-summary.sh |  194 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 194 insertions(+), 0 deletions(-)
 create mode 100755 t/t7401-submodule-summary.sh

diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
new file mode 100755
index 0000000..30d129c
--- /dev/null
+++ b/t/t7401-submodule-summary.sh
@@ -0,0 +1,194 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Ping Yin
+#
+
+test_description='Summary support for submodules
+
+This test tries to verify the sanity of summary subcommand of git-submodule.
+'
+
+. ./test-lib.sh
+
+add_file () {
+	sm=$1
+	shift
+	owd=$(pwd)
+	cd "$sm"
+	for name; do
+		echo "$name" > "$name" &&
+		git add "$name" &&
+		git commit -m "Add $name"
+	done >/dev/null
+	git rev-parse --verify HEAD | cut -c1-7
+	cd "$owd"
+}
+commit_file () {
+	git commit "$@" -m "Commit $*" >/dev/null
+}
+
+test_create_repo sm1 &&
+add_file . foo
+
+head1=$(add_file sm1 foo1 foo2)
+
+test_expect_success 'added submodule' "
+	git add sm1 &&
+	git submodule summary >actual &&
+	diff actual - <<-EOF
+* sm1 0000000...$head1 (2):
+  > Add foo2
+
+EOF
+"
+
+commit_file sm1 &&
+head2=$(add_file sm1 foo3)
+
+test_expect_success 'modified submodule(forward)' "
+	git submodule summary >actual &&
+	diff actual - <<-EOF
+* sm1 $head1...$head2 (1):
+  > Add foo3
+
+EOF
+"
+
+commit_file sm1 &&
+cd sm1 &&
+git reset --hard HEAD~2 >/dev/null &&
+head3=$(git rev-parse --verify HEAD | cut -c1-7) &&
+cd ..
+
+test_expect_success 'modified submodule(backward)' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head2...$head3 (2):
+  < Add foo3
+  < Add foo2
+
+EOF
+"
+
+sleep 1s
+head4=$(add_file sm1 foo4 foo5) &&
+head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)
+test_expect_success 'modified submodule(backward and forward)' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head2...$head4 (4):
+  > Add foo5
+  > Add foo4
+  < Add foo3
+  < Add foo2
+
+EOF
+"
+
+test_expect_success '--summary-limit' "
+    git submodule summary -n 3 >actual &&
+    diff actual - <<-EOF
+* sm1 $head2...$head4 (4):
+  > Add foo5
+  > Add foo4
+  < Add foo3
+
+EOF
+"
+
+commit_file sm1 &&
+mv sm1 sm1-bak &&
+echo sm1 >sm1 &&
+head5=$(git hash-object sm1 | cut -c1-7) &&
+git add sm1 &&
+rm -f sm1 &&
+mv sm1-bak sm1
+
+test_expect_success 'typechanged submodule(submodule->blob), --cached' "
+    git submodule summary --cached >actual &&
+    diff actual - <<-EOF
+* sm1 $head4(submodule)->$head5(blob) (3):
+  < Add foo5
+
+EOF
+"
+
+rm -rf sm1 &&
+git checkout-index sm1
+test_expect_success 'typechanged submodule(submodule->blob)' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head4(submodule)->$head5(blob):
+
+EOF
+"
+
+rm -f sm1 &&
+test_create_repo sm1 &&
+head6=$(add_file sm1 foo6 foo7)
+test_expect_success 'nonexistent commit' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head4...$head6:
+  Warn: sm1 doesn't contain commit $head4_full
+
+EOF
+"
+
+git commit -m "commit sm1" >/dev/null
+test_expect_success 'typechanged submodule(blob->submodule)' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head5(blob)->$head6(submodule) (2):
+  > Add foo7
+
+EOF
+"
+
+commit_file sm1 &&
+rm -rf sm1
+test_expect_success 'deleted submodule' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head6...0000000:
+
+EOF
+"
+
+test_create_repo sm2 &&
+head7=$(add_file sm2 foo8 foo9) &&
+git add sm2
+
+test_expect_success 'multiple submodules' "
+    git submodule summary >actual &&
+    diff actual - <<-EOF
+* sm1 $head6...0000000:
+
+* sm2 0000000...$head7 (2):
+  > Add foo9
+
+EOF
+"
+
+test_expect_success 'path filter' "
+    git submodule summary sm2 >actual &&
+    diff actual - <<-EOF
+* sm2 0000000...$head7 (2):
+  > Add foo9
+
+EOF
+"
+
+commit_file sm2
+test_expect_success 'given commit' "
+    git submodule summary HEAD^ >actual &&
+    diff actual - <<-EOF
+* sm1 $head6...0000000:
+
+* sm2 0000000...$head7 (2):
+  > Add foo9
+
+EOF
+"
+
+test_done
-- 
1.5.4.3.347.g5314c

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/5] git-submodule summary: show commit summary
  2008-03-10 17:54 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
  2008-03-10 17:54   ` [PATCH v4 3/5] git-submodule summary: limit summary size Ping Yin
@ 2008-03-10 17:58   ` Ping Yin
  2008-03-11  1:52   ` Ping Yin
  2008-03-11  7:28   ` Junio C Hamano
  3 siblings, 0 replies; 10+ messages in thread
From: Ping Yin @ 2008-03-10 17:58 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

On Tue, Mar 11, 2008 at 1:54 AM, Ping Yin <pkufranky@gmail.com> wrote:
> This patch does the hard work to show submodule commit summary.
>
>  For a modified submodule, a series of commits will be shown with
>  the following command
>
>         git log --pretty='format:%m %s' --left-right \
>         --first-parent sha1_src...sha1_dst
>

Relative to v3 patch series, there are only two changes in v4:

  1. this patch has minor bug fix
  2. add summary test



-- 
Ping Yin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/5] git-submodule summary: show commit summary
  2008-03-10 17:54 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
  2008-03-10 17:54   ` [PATCH v4 3/5] git-submodule summary: limit summary size 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
  3 siblings, 0 replies; 10+ messages in thread
From: Ping Yin @ 2008-03-11  1:52 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

On Tue, Mar 11, 2008 at 1:54 AM, Ping Yin <pkufranky@gmail.com> wrote:
> This patch does the hard work to show submodule commit summary.
>
>  For a modified submodule, a series of commits will be shown with
>  the following command
>
>         git log --pretty='format:%m %s' --left-right \
>         --first-parent sha1_src...sha1_dst
>
It seems that --left-right makes no sense when combined with
--pretty='format:%m %s'

I originally thought --left-right will make left-side commits always
appear before or after right side commits, but that's not the case.
Actually it seems that --left-right doesn't influence the commit
order.

Is my understanding right?

>  where the src sha1 is from the given super project commit and the
>  dst sha1 is from the index or working tree (switched by --cached).
>




-- 
Ping Yin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 5/5] git-submodule summary: test
  2008-03-10 17:54       ` [PATCH v4 5/5] git-submodule summary: test Ping Yin
@ 2008-03-11  1:57         ` Ping Yin
  0 siblings, 0 replies; 10+ messages in thread
From: Ping Yin @ 2008-03-11  1:57 UTC (permalink / raw)
  To: gitster; +Cc: git, Ping Yin

On Tue, Mar 11, 2008 at 1:54 AM, Ping Yin <pkufranky@gmail.com> wrote:
> Signed-off-by: Ping Yin <pkufranky@gmail.com>
>  ---
>   t/t7401-submodule-summary.sh |  194 ++++++++++++++++++++++++++++++++++++++++++
>  +
>  +sleep 1s
>  +head4=$(add_file sm1 foo4 foo5) &&
>  +head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)
>  +test_expect_success 'modified submodule(backward and forward)' "
>  +    git submodule summary >actual &&
>  +    diff actual - <<-EOF
>  +* sm1 $head2...$head4 (4):
>  +  > Add foo5
>  +  > Add foo4
>  +  < Add foo3
>  +  < Add foo2
>  +
>  +EOF
>  +"

'sleep 1s' is used to just make sure the summary result just has the
same commit order as i expected (the order is undefined if not using
this because the commit time are all the same).

However, it seems ugly. I will resend this patch later by using result
from 'git log --pretty=format' as the expected result.
>  +



-- 
Ping Yin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/5] git-submodule summary: show commit summary
  2008-03-10 17:54 ` [PATCH v4 2/5] git-submodule summary: show commit summary Ping Yin
                     ` (2 preceding siblings ...)
  2008-03-11  1:52   ` Ping Yin
@ 2008-03-11  7:28   ` Junio C Hamano
  2008-03-11  9:37     ` Ping Yin
  3 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2008-03-11  7:28 UTC (permalink / raw)
  To: Ping Yin; +Cc: git

Ping Yin <pkufranky@gmail.com> writes:

> This patch does the hard work to show submodule commit summary.
> ...

I've spent considerable amount of time cleaning up your commit log
messages for the entire series from the last round when I queued them to
'pu', but you seem to have discarded all of them.  As I do not have time
to waste doing clean-ups only to have others to discard, and I do not have
infinite amount of time, I won't be replacing them with this series
tonight.

> Signed-off-by: Ping Yin <pkufranky@gmail.com>

And you did not describe anything about the improvements from the previous
round anywhere.  interdiff shows that this part is somewhat different:

> +		then
> +			case "$mod_dst" in
> +				160000)
> +				sha1_dst=$(GIT_DIR="$name/.git" git rev-parse HEAD)
> +				;;
> +				100644)
> +				sha1_dst=$(git hash-object $name)
> +				;;
> +			esac

Earlier, you were ignoring the one that is not checked out anymore, but
now you blindly assume "rev-parse HEAD" to give you a usable sha1_dst.
Why?

If a path that previously was a module is changed to a symlink, what
happens?  

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/5] git-submodule summary: show commit summary
  2008-03-11  7:28   ` Junio C Hamano
@ 2008-03-11  9:37     ` Ping Yin
  0 siblings, 0 replies; 10+ messages in thread
From: Ping Yin @ 2008-03-11  9:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Tue, Mar 11, 2008 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ping Yin <pkufranky@gmail.com> writes:
>
>  > This patch does the hard work to show submodule commit summary.
>  > ...
>
>  I've spent considerable amount of time cleaning up your commit log
>  messages for the entire series from the last round when I queued them to
>  'pu', but you seem to have discarded all of them.  As I do not have time
>  to waste doing clean-ups only to have others to discard, and I do not have
>  infinite amount of time, I won't be replacing them with this series
>  tonight.
>

Sorry about this. This is my first big patch series and I have little
experience about submiting patches again and again. So i don't even
see your pu series except the documentation one you have mentioned in
the email (I thought other ones didn't change).

I'll resend my patches finally merging you commit log.

>
>  > Signed-off-by: Ping Yin <pkufranky@gmail.com>
>
>  And you did not describe anything about the improvements from the previous
>  round anywhere.  interdiff shows that this part is somewhat different:
>
>
>  > +             then
>  > +                     case "$mod_dst" in
>  > +                             160000)
>  > +                             sha1_dst=$(GIT_DIR="$name/.git" git rev-parse HEAD)
>  > +                             ;;
>  > +                             100644)
>  > +                             sha1_dst=$(git hash-object $name)
>  > +                             ;;
>  > +                     esac
>
>  Earlier, you were ignoring the one that is not checked out anymore, but
>  now you blindly assume "rev-parse HEAD" to give you a usable sha1_dst.
>  Why?

The path will not reach here for ignored submodules. Only user-cared
modules will get into the "$modules" variables (see "# Get modified
modules cared by user" part).
>
>  If a path that previously was a module is changed to a symlink, what
>  happens?
>



-- 
Ping Yin

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-03-11  9:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [PATCH v4 3/5] git-submodule summary: limit summary size Ping Yin
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

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).