{"thread":{"id":"12620","subject":"[PATCH v4 2/5] git-submodule summary: show commit summary","startedAt":"2008-03-10T17:54:13Z","lastAt":"2008-03-11T09:37:40Z","messageCount":10,"participants":["Ping Yin","Junio C Hamano"],"isPatch":true,"patchVersion":4,"patchTotal":5},"messages":[{"id":"71601","messageId":"1205171657-16216-1-git-send-email-pkufranky@gmail.com","threadId":"12620","inReplyTo":null,"subject":"[PATCH v4 1/5] git-submodule summary: code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-10T17:54:13Z","receivedAt":"2008-03-10T17:54:13Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"Following patches will teach git-submodule a new subcommand 'summary' to\nshow commit summary of user-cared (i.e. checked out) submodules between\na given super project commit (default to HEAD) and working tree\n(or index, switched by --cached).\n\nThis patch just introduces the framework and find submodules which has\nsummary to show. A submodule will have summary if it fits into any one of\nfollowing cases.\n\n  - type 'M': modified and checked out    (1)\n  - type 'A': added and checked out       (2)\n  - type 'D': deleted\n  - type 'T': typechanged (blob <-> submodule)\n\nNote:\n  1. There may be modified but not checked out cases. In the case of a\n     merge conflict, even if the submodule is not checked out, there may\n\t be still a diff between index and HEAD on the submodule entry\n\t (i.e. modified). The summary will not be show for such a submodule.\n  2. A similar explanation applies to the added but not checked out case.\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   61 +++++++++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 56 insertions(+), 5 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 7171cb6..b70ae40 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -4,7 +4,7 @@\n #\n # Copyright (c) 2007 Lars Hjemli\n \n-USAGE='[--quiet] [--cached] [add <repo> [-b branch]|status|init|update] [--] [<path>...]'\n+USAGE='[--quiet] [--cached] [add <repo> [-b branch]|status|init|update|summary [<commit>]] [--] [<path>...]'\n OPTIONS_SPEC=\n . git-sh-setup\n require_work_tree\n@@ -330,7 +330,58 @@ set_name_rev () {\n \t) )\n \ttest -z \"$revname\" || revname=\" ($revname)\"\n }\n+#\n+# Show commit summary for submodules in index or working tree\n+#\n+# If '--cached' is given, show summary between index and given commit,\n+# or between working tree and given commit\n+#\n+# $@ = [commit (default 'HEAD'),] requested paths (default all)\n+#\n+cmd_summary() {\n+\t# parse $args after \"submodule ... summary\".\n+\twhile test $# -ne 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--cached)\n+\t\t\tcached=\"$1\"\n+\t\t\t;;\n+\t\t--)\n+\t\t\tshift\n+\t\t\tbreak\n+\t\t\t;;\n+\t\t-*)\n+\t\t\tusage\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\t\tesac\n+\t\tshift\n+\tdone\n \n+\tif rev=$(git rev-parse --verify \"$1^0\" 2>/dev/null)\n+\tthen\n+\t\thead=$rev\n+\t\tshift\n+\telse\n+\t\thead=HEAD\n+\tfi\n+\n+\tcd_to_toplevel\n+\t# Get modified modules cared by user\n+\tmodules=$(git diff-index $cached --raw $head -- \"$@\" |\n+\t\tgrep -e '^:160000' -e '^:[0-7]* 160000' |\n+\t\twhile read mod_src mod_dst sha1_src sha1_dst status name\n+\t\tdo\n+\t\t\t# Always show modules deleted or type-changed (blob<->module)\n+\t\t\ttest $status = D -o $status = T && echo \"$name\" && continue\n+\t\t\t# Also show added or modified modules which are checked out\n+\t\t\tGIT_DIR=\"$name/.git\" git-rev-parse --git-dir >/dev/null 2>&1 &&\n+\t\t\techo \"$name\"\n+\t\tdone\n+\t)\n+}\n #\n # List all submodules, prefixed with:\n #  - submodule not initialized\n@@ -401,7 +452,7 @@ cmd_status()\n while test $# != 0 && test -z \"$command\"\n do\n \tcase \"$1\" in\n-\tadd | init | update | status)\n+\tadd | init | update | status | summary)\n \t\tcommand=$1\n \t\t;;\n \t-q|--quiet)\n@@ -416,7 +467,7 @@ do\n \t\tbranch=\"$2\"; shift\n \t\t;;\n \t--cached)\n-\t\tcached=1\n+\t\tcached=\"$1\"\n \t\t;;\n \t--)\n \t\tbreak\n@@ -440,8 +491,8 @@ then\n \tusage\n fi\n \n-# \"--cached\" is accepted only by \"status\"\n-if test -n \"$cached\" && test \"$command\" != status\n+# \"--cached\" is accepted only by \"status\" and \"summary\"\n+if test -n \"$cached\" && test \"$command\" != status -a \"$command\" != summary\n then\n \tusage\n fi\n-- \n1.5.4.3.347.g5314c\n"},{"id":"71598","messageId":"1205171657-16216-2-git-send-email-pkufranky@gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-1-git-send-email-pkufranky@gmail.com","subject":"[PATCH v4 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-10T17:54:14Z","receivedAt":"2008-03-10T17:54:14Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"This patch does the hard work to show submodule commit summary.\n\nFor a modified submodule, a series of commits will be shown with\nthe following command\n\n\tgit log --pretty='format:%m %s' --left-right \\\n\t--first-parent sha1_src...sha1_dst\n\nwhere the src sha1 is from the given super project commit and the\ndst sha1 is from the index or working tree (switched by --cached).\n\nFor a deleted, added, or typechanged (blob<->submodule) submodule,\nonly one single newest commit from the existing end (for example,\nsrc end for submodule deleted or type changed from submodule to blob)\nwill be shown.\n\nIf the src/dst sha1 for a submodule is missing in the submodule\ndirectory, a warning will be issued except in two cases where the\nsubmodule directory is deleted (type 'D') or typechanged to blob\n(one case of type 'T').\n\nIn the title line for a submodule, the src/dst sha1 and the number\nof commits (--first-parent) between the two sha1s will be shown.\n\nThe following example demonstrates most cases.\n\nExample: commit summary for modified submodules sm1-sm5.\n--------------------------------------------\n$ git submodule summary\n* sm1 354cd45...3f751e5 (4):\n  < one line message for C\n  < one line message for B\n  > one line message for D\n  > one line message for E\n\n* sm2 5c8bfb5...000000 (3):\n  < one line message for F\n\n* sm3 354cd45...3f751e5:\n  Warn: sm3 doesn't contain commit 354cd45\n\n* sm4 354cd34(submodule)-> 235efa(blob) (1):\n  < one line message for G\n\n* sm5 354cd34(blob)-> 235efa(submodule) (5):\n  > one line message for H\n\n--------------------------------------------\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 96 insertions(+), 0 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex b70ae40..c9afa06 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -381,6 +381,102 @@ cmd_summary() {\n \t\t\techo \"$name\"\n \t\tdone\n \t)\n+\n+\ttest -n \"$modules\" &&\n+\tgit diff-index $cached --raw $head -- $modules |\n+\tgrep -e '^:160000' -e '^:[0-7]* 160000' |\n+\tcut -c2- |\n+\twhile read mod_src mod_dst sha1_src sha1_dst status name\n+\tdo\n+\t\tif test -z \"$cached\" &&\n+\t\t\ttest $sha1_dst = 0000000000000000000000000000000000000000\n+\t\tthen\n+\t\t\tcase \"$mod_dst\" in\n+\t\t\t\t160000)\n+\t\t\t\tsha1_dst=$(GIT_DIR=\"$name/.git\" git rev-parse HEAD)\n+\t\t\t\t;;\n+\t\t\t\t100644)\n+\t\t\t\tsha1_dst=$(git hash-object $name)\n+\t\t\t\t;;\n+\t\t\tesac\n+\t\tfi\n+\t\tmissing_src=\n+\t\tmissing_dst=\n+\n+\t\ttest $mod_src = 160000 &&\n+\t\t! GIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 &&\n+\t\tmissing_src=t\n+\n+\t\ttest $mod_dst = 160000 &&\n+\t\t! GIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_dst^0 >/dev/null 2>&1 &&\n+\t\tmissing_dst=t\n+\n+\t\ttotal_commits=\n+\t\tcase \"$missing_src,$missing_dst\" in\n+\t\tt,)\n+\t\t\terrmsg=\"  Warn: $name doesn't contain commit $sha1_src\"\n+\t\t\t;;\n+\t\t,t)\n+\t\t\terrmsg=\"  Warn: $name doesn't contain commit $sha1_dst\"\n+\t\t\t;;\n+\t\tt,t)\n+\t\t\terrmsg=\"  Warn: $name doesn't contain commits $sha1_src and $sha1_dst\"\n+\t\t\t;;\n+\t\t*)\n+\t\t\terrmsg=\n+\t\t\ttotal_commits=$(\n+\t\t\tif test $mod_src = 160000 -a $mod_dst = 160000\n+\t\t\tthen\n+\t\t\t\trange=\"$sha1_src...$sha1_dst\"\n+\t\t\telif test $mod_src = 160000\n+\t\t\tthen\n+\t\t\t\trange=$sha1_src\n+\t\t\telse\n+\t\t\t\trange=$sha1_dst\n+\t\t\tfi\n+\t\t\tGIT_DIR=\"$name/.git\" \\\n+\t\t\tgit log --pretty=oneline --first-parent $range | wc -l\n+\t\t\t)\n+\t\t\ttotal_commits=\" ($total_commits)\"\n+\t\t\t;;\n+\t\tesac\n+\n+\t\tsha1_abbr_src=$(echo $sha1_src | cut -c1-7)\n+\t\tsha1_abbr_dst=$(echo $sha1_dst | cut -c1-7)\n+\t\tif test $status = T\n+\t\tthen\n+\t\t\tif test $mod_dst = 160000\n+\t\t\tthen\n+\t\t\t\techo \"* $name $sha1_abbr_src(blob)->$sha1_abbr_dst(submodule)$total_commits:\"\n+\t\t\telse\n+\t\t\t\techo \"* $name $sha1_abbr_src(submodule)->$sha1_abbr_dst(blob)$total_commits:\"\n+\t\t\tfi\n+\t\telse\n+\t\t\techo \"* $name $sha1_abbr_src...$sha1_abbr_dst$total_commits:\"\n+\t\tfi\n+\t\tif test -n \"$errmsg\"\n+\t\tthen\n+\t\t\t# Don't give error msg for modification whose dst is not submodule\n+\t\t\t# i.e. deleted or changed to blob\n+\t\t\ttest $mod_dst = 160000 && echo \"$errmsg\"\n+\t\telse\n+\t\t\tif test $mod_src = 160000 -a $mod_dst = 160000\n+\t\t\tthen\n+\t\t\t\tGIT_DIR=\"$name/.git\" \\\n+\t\t\t\tgit log --pretty='format:  %m %s' \\\n+\t\t\t\t--left-right --first-parent $sha1_src...$sha1_dst\n+\t\t\telif test $mod_dst = 160000\n+\t\t\tthen\n+\t\t\t\tGIT_DIR=\"$name/.git\" \\\n+\t\t\t\tgit log --pretty='format:  > %s' -1 $sha1_dst\n+\t\t\telse\n+\t\t\t\tGIT_DIR=\"$name/.git\" \\\n+\t\t\t\tgit log --pretty='format:  < %s' -1 $sha1_src\n+\t\t\tfi\n+\t\t\techo\n+\t\tfi\n+\t\techo\n+\tdone\n }\n #\n # List all submodules, prefixed with:\n-- \n1.5.4.3.347.g5314c\n"},{"id":"71600","messageId":"1205171657-16216-3-git-send-email-pkufranky@gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-2-git-send-email-pkufranky@gmail.com","subject":"[PATCH v4 3/5] git-submodule summary: limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-10T17:54:15Z","receivedAt":"2008-03-10T17:54:15Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"This patch teaches git-submodule an option '--summary-limit|-n <number>'\nto limit number of commits in total for the summary of each submodule in\nthe modified case (only a single commit is shown in other cases).\n\nNumber 0 will disable summary and minus number means unlimted (the default).\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   21 +++++++++++++++++++--\n 1 files changed, 19 insertions(+), 2 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex c9afa06..e52e261 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -4,7 +4,9 @@\n #\n # Copyright (c) 2007 Lars Hjemli\n \n-USAGE='[--quiet] [--cached] [add <repo> [-b branch]|status|init|update|summary [<commit>]] [--] [<path>...]'\n+USAGE=\"[--quiet] [--cached] \\\n+[add <repo> [-b branch]|status|init|update|summary [-n|--summary-limit <n>] [<commit>]] \\\n+[--] [<path>...]\"\n OPTIONS_SPEC=\n . git-sh-setup\n require_work_tree\n@@ -339,6 +341,8 @@ set_name_rev () {\n # $@ = [commit (default 'HEAD'),] requested paths (default all)\n #\n cmd_summary() {\n+\tsummary_limit=-1\n+\n \t# parse $args after \"submodule ... summary\".\n \twhile test $# -ne 0\n \tdo\n@@ -346,6 +350,15 @@ cmd_summary() {\n \t\t--cached)\n \t\t\tcached=\"$1\"\n \t\t\t;;\n+\t\t-n|--summary-limit)\n+\t\t\tif summary_limit=$(($2 + 0)) 2>/dev/null && test \"$summary_limit\" = \"$2\"\n+\t\t\tthen\n+\t\t\t\t:\n+\t\t\telse\n+\t\t\t\tusage\n+\t\t\tfi\n+\t\t\tshift\n+\t\t\t;;\n \t\t--)\n \t\t\tshift\n \t\t\tbreak\n@@ -360,6 +373,8 @@ cmd_summary() {\n \t\tshift\n \tdone\n \n+\ttest $summary_limit = 0 && return\n+\n \tif rev=$(git rev-parse --verify \"$1^0\" 2>/dev/null)\n \tthen\n \t\thead=$rev\n@@ -462,8 +477,10 @@ cmd_summary() {\n \t\telse\n \t\t\tif test $mod_src = 160000 -a $mod_dst = 160000\n \t\t\tthen\n+\t\t\t\tlimit=\n+\t\t\t\ttest $summary_limit -gt 0 && limit=\"-$summary_limit\"\n \t\t\t\tGIT_DIR=\"$name/.git\" \\\n-\t\t\t\tgit log --pretty='format:  %m %s' \\\n+\t\t\t\tgit log $limit --pretty='format:  %m %s' \\\n \t\t\t\t--left-right --first-parent $sha1_src...$sha1_dst\n \t\t\telif test $mod_dst = 160000\n \t\t\tthen\n-- \n1.5.4.3.347.g5314c\n"},{"id":"71602","messageId":"1205171657-16216-4-git-send-email-pkufranky@gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-3-git-send-email-pkufranky@gmail.com","subject":"[PATCH v4 4/5] git-submodule summary: documentation","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-10T17:54:16Z","receivedAt":"2008-03-10T17:54:16Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"Signed-off-by: Ping Yin <pkufranky@gmail.com>\n---\n Documentation/git-submodule.txt |   19 ++++++++++++++++---\n 1 files changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex b4d0160..41f9f63 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -12,6 +12,7 @@ SYNOPSIS\n 'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>]\n 'git-submodule' [--quiet] status [--cached] [--] [<path>...]\n 'git-submodule' [--quiet] [init|update] [--] [<path>...]\n+'git-submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]\n \n \n COMMANDS\n@@ -47,6 +48,11 @@ update::\n \tcheckout the commit specified in the index of the containing repository.\n \tThis will make the submodules HEAD be detached.\n \n+summary::\n+\tShow commit summary between the given commit (defaults to HEAD) and\n+\tworking tree/index. For a submodule in question, a series of commits\n+\tin the submodule between the given super project commit and the\n+\tindex or working tree (switched by --cached) are shown.\n \n OPTIONS\n -------\n@@ -57,9 +63,16 @@ OPTIONS\n \tBranch of repository to add as submodule.\n \n --cached::\n-\tDisplay the SHA-1 stored in the index, not the SHA-1 of the currently\n-\tchecked out submodule commit. This option is only valid for the\n-\tstatus command.\n+\tThis option is only valid for status and summary commands.  These\n+\tcommands typically use the commit found in the submodule HEAD, but\n+\twith this option, the commit stored in the index is used instead.\n+\n+-n, --summary-limit::\n+\tThis option is only valid for the summary command.\n+\tLimit the summary size (number of commits shown in total).\n+\tGiving 0 will disable the summary; a negative number means unlimted\n+\t(the default). This limit only applies to modified submodules. The\n+\tsize is always limited to 1 for added/deleted/typechanged submodules.\n \n <path>::\n \tPath to submodule(s). When specified this will restrict the command\n-- \n1.5.4.3.347.g5314c\n"},{"id":"71599","messageId":"1205171657-16216-5-git-send-email-pkufranky@gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-4-git-send-email-pkufranky@gmail.com","subject":"[PATCH v4 5/5] git-submodule summary: test","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-10T17:54:17Z","receivedAt":"2008-03-10T17:54:17Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"Signed-off-by: Ping Yin <pkufranky@gmail.com>\n---\n t/t7401-submodule-summary.sh |  194 ++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 194 insertions(+), 0 deletions(-)\n create mode 100755 t/t7401-submodule-summary.sh\n\ndiff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh\nnew file mode 100755\nindex 0000000..30d129c\n--- /dev/null\n+++ b/t/t7401-submodule-summary.sh\n@@ -0,0 +1,194 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Ping Yin\n+#\n+\n+test_description='Summary support for submodules\n+\n+This test tries to verify the sanity of summary subcommand of git-submodule.\n+'\n+\n+. ./test-lib.sh\n+\n+add_file () {\n+\tsm=$1\n+\tshift\n+\towd=$(pwd)\n+\tcd \"$sm\"\n+\tfor name; do\n+\t\techo \"$name\" > \"$name\" &&\n+\t\tgit add \"$name\" &&\n+\t\tgit commit -m \"Add $name\"\n+\tdone >/dev/null\n+\tgit rev-parse --verify HEAD | cut -c1-7\n+\tcd \"$owd\"\n+}\n+commit_file () {\n+\tgit commit \"$@\" -m \"Commit $*\" >/dev/null\n+}\n+\n+test_create_repo sm1 &&\n+add_file . foo\n+\n+head1=$(add_file sm1 foo1 foo2)\n+\n+test_expect_success 'added submodule' \"\n+\tgit add sm1 &&\n+\tgit submodule summary >actual &&\n+\tdiff actual - <<-EOF\n+* sm1 0000000...$head1 (2):\n+  > Add foo2\n+\n+EOF\n+\"\n+\n+commit_file sm1 &&\n+head2=$(add_file sm1 foo3)\n+\n+test_expect_success 'modified submodule(forward)' \"\n+\tgit submodule summary >actual &&\n+\tdiff actual - <<-EOF\n+* sm1 $head1...$head2 (1):\n+  > Add foo3\n+\n+EOF\n+\"\n+\n+commit_file sm1 &&\n+cd sm1 &&\n+git reset --hard HEAD~2 >/dev/null &&\n+head3=$(git rev-parse --verify HEAD | cut -c1-7) &&\n+cd ..\n+\n+test_expect_success 'modified submodule(backward)' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head2...$head3 (2):\n+  < Add foo3\n+  < Add foo2\n+\n+EOF\n+\"\n+\n+sleep 1s\n+head4=$(add_file sm1 foo4 foo5) &&\n+head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)\n+test_expect_success 'modified submodule(backward and forward)' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head2...$head4 (4):\n+  > Add foo5\n+  > Add foo4\n+  < Add foo3\n+  < Add foo2\n+\n+EOF\n+\"\n+\n+test_expect_success '--summary-limit' \"\n+    git submodule summary -n 3 >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head2...$head4 (4):\n+  > Add foo5\n+  > Add foo4\n+  < Add foo3\n+\n+EOF\n+\"\n+\n+commit_file sm1 &&\n+mv sm1 sm1-bak &&\n+echo sm1 >sm1 &&\n+head5=$(git hash-object sm1 | cut -c1-7) &&\n+git add sm1 &&\n+rm -f sm1 &&\n+mv sm1-bak sm1\n+\n+test_expect_success 'typechanged submodule(submodule->blob), --cached' \"\n+    git submodule summary --cached >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head4(submodule)->$head5(blob) (3):\n+  < Add foo5\n+\n+EOF\n+\"\n+\n+rm -rf sm1 &&\n+git checkout-index sm1\n+test_expect_success 'typechanged submodule(submodule->blob)' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head4(submodule)->$head5(blob):\n+\n+EOF\n+\"\n+\n+rm -f sm1 &&\n+test_create_repo sm1 &&\n+head6=$(add_file sm1 foo6 foo7)\n+test_expect_success 'nonexistent commit' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head4...$head6:\n+  Warn: sm1 doesn't contain commit $head4_full\n+\n+EOF\n+\"\n+\n+git commit -m \"commit sm1\" >/dev/null\n+test_expect_success 'typechanged submodule(blob->submodule)' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head5(blob)->$head6(submodule) (2):\n+  > Add foo7\n+\n+EOF\n+\"\n+\n+commit_file sm1 &&\n+rm -rf sm1\n+test_expect_success 'deleted submodule' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head6...0000000:\n+\n+EOF\n+\"\n+\n+test_create_repo sm2 &&\n+head7=$(add_file sm2 foo8 foo9) &&\n+git add sm2\n+\n+test_expect_success 'multiple submodules' \"\n+    git submodule summary >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head6...0000000:\n+\n+* sm2 0000000...$head7 (2):\n+  > Add foo9\n+\n+EOF\n+\"\n+\n+test_expect_success 'path filter' \"\n+    git submodule summary sm2 >actual &&\n+    diff actual - <<-EOF\n+* sm2 0000000...$head7 (2):\n+  > Add foo9\n+\n+EOF\n+\"\n+\n+commit_file sm2\n+test_expect_success 'given commit' \"\n+    git submodule summary HEAD^ >actual &&\n+    diff actual - <<-EOF\n+* sm1 $head6...0000000:\n+\n+* sm2 0000000...$head7 (2):\n+  > Add foo9\n+\n+EOF\n+\"\n+\n+test_done\n-- \n1.5.4.3.347.g5314c\n"},{"id":"71603","messageId":"46dff0320803101058k451d589dl1b3f764e273630f7@mail.gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-2-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v4 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-10T17:58:04Z","receivedAt":"2008-03-10T17:58:04Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Tue, Mar 11, 2008 at 1:54 AM, Ping Yin <pkufranky@gmail.com> wrote:\n> This patch does the hard work to show submodule commit summary.\n>\n>  For a modified submodule, a series of commits will be shown with\n>  the following command\n>\n>         git log --pretty='format:%m %s' --left-right \\\n>         --first-parent sha1_src...sha1_dst\n>\n\nRelative to v3 patch series, there are only two changes in v4:\n\n  1. this patch has minor bug fix\n  2. add summary test\n\n\n\n-- \nPing Yin\n"},{"id":"71638","messageId":"46dff0320803101852j421646e6t5b8c71b656c72935@mail.gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-2-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v4 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T01:52:13Z","receivedAt":"2008-03-11T01:52:13Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Tue, Mar 11, 2008 at 1:54 AM, Ping Yin <pkufranky@gmail.com> wrote:\n> This patch does the hard work to show submodule commit summary.\n>\n>  For a modified submodule, a series of commits will be shown with\n>  the following command\n>\n>         git log --pretty='format:%m %s' --left-right \\\n>         --first-parent sha1_src...sha1_dst\n>\nIt seems that --left-right makes no sense when combined with\n--pretty='format:%m %s'\n\nI originally thought --left-right will make left-side commits always\nappear before or after right side commits, but that's not the case.\nActually it seems that --left-right doesn't influence the commit\norder.\n\nIs my understanding right?\n\n>  where the src sha1 is from the given super project commit and the\n>  dst sha1 is from the index or working tree (switched by --cached).\n>\n\n\n\n\n-- \nPing Yin\n"},{"id":"71639","messageId":"46dff0320803101857t435ec42g93c3605ec64d710a@mail.gmail.com","threadId":"12620","inReplyTo":"1205171657-16216-5-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v4 5/5] git-submodule summary: test","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T01:57:27Z","receivedAt":"2008-03-11T01:57:27Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Tue, Mar 11, 2008 at 1:54 AM, Ping Yin <pkufranky@gmail.com> wrote:\n> Signed-off-by: Ping Yin <pkufranky@gmail.com>\n>  ---\n>   t/t7401-submodule-summary.sh |  194 ++++++++++++++++++++++++++++++++++++++++++\n>  +\n>  +sleep 1s\n>  +head4=$(add_file sm1 foo4 foo5) &&\n>  +head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)\n>  +test_expect_success 'modified submodule(backward and forward)' \"\n>  +    git submodule summary >actual &&\n>  +    diff actual - <<-EOF\n>  +* sm1 $head2...$head4 (4):\n>  +  > Add foo5\n>  +  > Add foo4\n>  +  < Add foo3\n>  +  < Add foo2\n>  +\n>  +EOF\n>  +\"\n\n'sleep 1s' is used to just make sure the summary result just has the\nsame commit order as i expected (the order is undefined if not using\nthis because the commit time are all the same).\n\nHowever, it seems ugly. I will resend this patch later by using result\nfrom 'git log --pretty=format' as the expected result.\n>  +\n\n\n\n-- \nPing Yin\n"},{"id":"71661","messageId":"7vod9ld8iu.fsf@gitster.siamese.dyndns.org","threadId":"12620","inReplyTo":"1205171657-16216-2-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v4 2/5] git-submodule summary: show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-11T07:28:25Z","receivedAt":"2008-03-11T07:28:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ping Yin <pkufranky@gmail.com> writes:\n\n> This patch does the hard work to show submodule commit summary.\n> ...\n\nI've spent considerable amount of time cleaning up your commit log\nmessages for the entire series from the last round when I queued them to\n'pu', but you seem to have discarded all of them.  As I do not have time\nto waste doing clean-ups only to have others to discard, and I do not have\ninfinite amount of time, I won't be replacing them with this series\ntonight.\n\n> Signed-off-by: Ping Yin <pkufranky@gmail.com>\n\nAnd you did not describe anything about the improvements from the previous\nround anywhere.  interdiff shows that this part is somewhat different:\n\n> +\t\tthen\n> +\t\t\tcase \"$mod_dst\" in\n> +\t\t\t\t160000)\n> +\t\t\t\tsha1_dst=$(GIT_DIR=\"$name/.git\" git rev-parse HEAD)\n> +\t\t\t\t;;\n> +\t\t\t\t100644)\n> +\t\t\t\tsha1_dst=$(git hash-object $name)\n> +\t\t\t\t;;\n> +\t\t\tesac\n\nEarlier, you were ignoring the one that is not checked out anymore, but\nnow you blindly assume \"rev-parse HEAD\" to give you a usable sha1_dst.\nWhy?\n\nIf a path that previously was a module is changed to a symlink, what\nhappens?  \n"},{"id":"71676","messageId":"46dff0320803110237t6fcd6675t48949423e14f64a5@mail.gmail.com","threadId":"12620","inReplyTo":"7vod9ld8iu.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v4 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T09:37:40Z","receivedAt":"2008-03-11T09:37:40Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Tue, Mar 11, 2008 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ping Yin <pkufranky@gmail.com> writes:\n>\n>  > This patch does the hard work to show submodule commit summary.\n>  > ...\n>\n>  I've spent considerable amount of time cleaning up your commit log\n>  messages for the entire series from the last round when I queued them to\n>  'pu', but you seem to have discarded all of them.  As I do not have time\n>  to waste doing clean-ups only to have others to discard, and I do not have\n>  infinite amount of time, I won't be replacing them with this series\n>  tonight.\n>\n\nSorry about this. This is my first big patch series and I have little\nexperience about submiting patches again and again. So i don't even\nsee your pu series except the documentation one you have mentioned in\nthe email (I thought other ones didn't change).\n\nI'll resend my patches finally merging you commit log.\n\n>\n>  > Signed-off-by: Ping Yin <pkufranky@gmail.com>\n>\n>  And you did not describe anything about the improvements from the previous\n>  round anywhere.  interdiff shows that this part is somewhat different:\n>\n>\n>  > +             then\n>  > +                     case \"$mod_dst\" in\n>  > +                             160000)\n>  > +                             sha1_dst=$(GIT_DIR=\"$name/.git\" git rev-parse HEAD)\n>  > +                             ;;\n>  > +                             100644)\n>  > +                             sha1_dst=$(git hash-object $name)\n>  > +                             ;;\n>  > +                     esac\n>\n>  Earlier, you were ignoring the one that is not checked out anymore, but\n>  now you blindly assume \"rev-parse HEAD\" to give you a usable sha1_dst.\n>  Why?\n\nThe path will not reach here for ignored submodules. Only user-cared\nmodules will get into the \"$modules\" variables (see \"# Get modified\nmodules cared by user\" part).\n>\n>  If a path that previously was a module is changed to a symlink, what\n>  happens?\n>\n\n\n\n-- \nPing Yin\n"}]}