{"thread":{"id":"12639","subject":"[PATCH v5 0/5] git-submodule summary","startedAt":"2008-03-11T13:52:14Z","lastAt":"2008-03-12T08:30:01Z","messageCount":14,"participants":["Ping Yin","Junio C Hamano","Johannes Sixt"],"isPatch":true,"patchVersion":5,"patchTotal":5},"messages":[{"id":"71703","messageId":"1205243539-797-1-git-send-email-pkufranky@gmail.com","threadId":"12639","inReplyTo":null,"subject":"[PATCH v5 0/5] git-submodule summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T13:52:14Z","receivedAt":"2008-03-11T13:52:14Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"Relative to v3 series, this series has following changes:\n\n- Improve and fix 'show commit summary' patch\n  * Remove --left-right when showing summary for modified modules\n  * Remove '%h' from \"--pretty=format:\" for added/deleted/typechanged\n    modules\n  * Also compute sha1 for blob when blob has sha1 0{40}\n- Merge commit log and document patch from junio\n- Add test\n"},{"id":"71707","messageId":"1205243539-797-2-git-send-email-pkufranky@gmail.com","threadId":"12639","inReplyTo":"1205243539-797-1-git-send-email-pkufranky@gmail.com","subject":"[PATCH v5 1/5] git-submodule summary: code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T13:52:15Z","receivedAt":"2008-03-11T13:52:15Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"These patches teach git-submodule a new subcommand 'summary' to show\ncommit summary of checked out submodules between a given super project\ncommit (defaults to HEAD) and working tree (or index, when --cached is\ngiven).\n\nThis patch just introduces the framework to find submodules which have\nsummary to show. A submodule will have summary if it falls into these\ncases:\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\nNotes:\n\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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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":"71706","messageId":"1205243539-797-3-git-send-email-pkufranky@gmail.com","threadId":"12639","inReplyTo":"1205243539-797-2-git-send-email-pkufranky@gmail.com","subject":"[PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T13:52:16Z","receivedAt":"2008-03-11T13:52:16Z","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    git log --pretty='format:%m %s' \\\n        --first-parent sha1_src...sha1_dst\n\nwhere the sha1_src is from the given super project commit and the\nsha1_dst 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 commits will be shown.\n\nThe following example demonstrates most cases.\n\n    Example: 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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..b90e132 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--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":"71708","messageId":"1205243539-797-4-git-send-email-pkufranky@gmail.com","threadId":"12639","inReplyTo":"1205243539-797-3-git-send-email-pkufranky@gmail.com","subject":"[PATCH v5 3/5] git-submodule summary: limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T13:52:17Z","receivedAt":"2008-03-11T13:52:17Z","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\nGiving 0 will disable the summary; a negative number means unlimted, which\nis the default.\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 b90e132..3f76b15 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--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":"71704","messageId":"1205243539-797-5-git-send-email-pkufranky@gmail.com","threadId":"12639","inReplyTo":"1205243539-797-4-git-send-email-pkufranky@gmail.com","subject":"[PATCH v5 4/5] git-submodule summary: documentation","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T13:52:18Z","receivedAt":"2008-03-11T13:52:18Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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":"71705","messageId":"1205243539-797-6-git-send-email-pkufranky@gmail.com","threadId":"12639","inReplyTo":"1205243539-797-5-git-send-email-pkufranky@gmail.com","subject":"[PATCH v5 5/5] git-submodule summary: test","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-11T13:52:19Z","receivedAt":"2008-03-11T13:52:19Z","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 |  195 ++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 195 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..0f3c42a\n--- /dev/null\n+++ b/t/t7401-submodule-summary.sh\n@@ -0,0 +1,195 @@\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\ttest_tick &&\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+\ttest_tick &&\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+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+commit_file\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":"71761","messageId":"46dff0320803111908m3f370ebbj89ee0511bb086cb0@mail.gmail.com","threadId":"12639","inReplyTo":"1205243539-797-3-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-12T02:08:10Z","receivedAt":"2008-03-12T02:08:10Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Tue, Mar 11, 2008 at 9:52 PM, Ping Yin <pkufranky@gmail.com> wrote:\n> This patch does the hard work to show submodule commit summary.\n>\n\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\nplease s/100644/100*/\n\n\n\n-- \nPing Yin\n"},{"id":"71763","messageId":"7vwso8adxh.fsf@gitster.siamese.dyndns.org","threadId":"12639","inReplyTo":"46dff0320803111908m3f370ebbj89ee0511bb086cb0@mail.gmail.com","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-12T02:12:10Z","receivedAt":"2008-03-12T02:12:10Z","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> On Tue, Mar 11, 2008 at 9:52 PM, Ping Yin <pkufranky@gmail.com> wrote:\n>> This patch does the hard work to show submodule commit summary.\n>>\n>\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> please s/100644/100*/\n\nHow would that help symbolic links?\n"},{"id":"71769","messageId":"46dff0320803111930r5ffe10b8k49a777ce3481643@mail.gmail.com","threadId":"12639","inReplyTo":"7vwso8adxh.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-12T02:30:35Z","receivedAt":"2008-03-12T02:30:35Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Wed, Mar 12, 2008 at 10:12 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n>  > On Tue, Mar 11, 2008 at 9:52 PM, Ping Yin <pkufranky@gmail.com> wrote:\n>  >> This patch does the hard work to show submodule commit summary.\n>  >>\n>  >\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>  > please s/100644/100*/\n>\n>  How would that help symbolic links?\n>\n\nI am not familiar with git core code, could you tell me where to find\nall file mod for various types?\n\n\n\n-- \nPing Yin\n"},{"id":"71775","messageId":"7vabl48tt4.fsf@gitster.siamese.dyndns.org","threadId":"12639","inReplyTo":"1205243539-797-3-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-12T04:12:07Z","receivedAt":"2008-03-12T04:12:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I've squashed a moral equivalent of the following into this patch (I also\nre-indented \"case...esac\").  Will perhaps queue in 'next' and after that\nwe can incrementally improve on it.\n\nThanks.\n\n git-submodule.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex a0ea913..ea23b45 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -400,7 +400,7 @@ cmd_summary() {\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\t100644 | 100755 | 120000)\n \t\t\t\tsha1_dst=$(git hash-object $name)\n \t\t\t\t;;\n \t\t\tesac\n"},{"id":"71777","messageId":"46dff0320803112128j23337873jf1fb12f5716151d8@mail.gmail.com","threadId":"12639","inReplyTo":"7vabl48tt4.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-12T04:28:59Z","receivedAt":"2008-03-12T04:28:59Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Wed, Mar 12, 2008 at 12:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> --- a/git-submodule.sh\n>  +++ b/git-submodule.sh\n>  @@ -400,7 +400,7 @@ cmd_summary() {\n>\n>                                 160000)\n>                                 sha1_dst=$(GIT_DIR=\"$name/.git\" git rev-parse HEAD)\n>                                 ;;\n>  -                               100644)\n>  +                               100644 | 100755 | 120000)\n>\nAre 644 and 755 file permission bit? If it is, how about the other\ncases (655, 744 and so on)?\n\n\n\n-- \nPing Yin\n"},{"id":"71786","messageId":"7vmyp479i9.fsf@gitster.siamese.dyndns.org","threadId":"12639","inReplyTo":"46dff0320803112128j23337873jf1fb12f5716151d8@mail.gmail.com","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-12T06:15:58Z","receivedAt":"2008-03-12T06:15:58Z","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> On Wed, Mar 12, 2008 at 12:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> --- a/git-submodule.sh\n>>  +++ b/git-submodule.sh\n>>  @@ -400,7 +400,7 @@ cmd_summary() {\n>>\n>>                                 160000)\n>>                                 sha1_dst=$(GIT_DIR=\"$name/.git\" git rev-parse HEAD)\n>>                                 ;;\n>>  -                               100644)\n>>  +                               100644 | 100755 | 120000)\n>>\n> Are 644 and 755 file permission bit? If it is, how about the other\n> cases (655, 744 and so on)?\n\nThey never appear, as git tracks only one executable bit, so mode bits for\nregular file blobs are canonicalized to either 100755 or 100644.\n\nDon't you ever see 000000 mode bits here?  There is no case arm for that\nin the code.\n"},{"id":"71795","messageId":"46dff0320803120127o62d484eaw54ecebafe88a0eac@mail.gmail.com","threadId":"12639","inReplyTo":"7vmyp479i9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v5 2/5] git-submodule summary: show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-12T08:27:31Z","receivedAt":"2008-03-12T08:27:31Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Wed, Mar 12, 2008 at 2:15 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n\n>\n>  They never appear, as git tracks only one executable bit, so mode bits for\n>  regular file blobs are canonicalized to either 100755 or 100644.\n>\n>  Don't you ever see 000000 mode bits here?  There is no case arm for that\n>  in the code.\n>\n000000 mode will appear for added or deleted or unmerged modules. The\ndeleted/added case has already been handled. However, the unmerged\ncase is not handled yet which will appear at very low frequency. So\nthis case can be delayed to handle.\n\n\n-- \nPing Yin\n"},{"id":"71796","messageId":"47D79489.2070004@viscovery.net","threadId":"12639","inReplyTo":"1205243539-797-3-git-send-email-pkufranky@gmail.com","subject":"[PATCH] git-submodule summary: fix that some \"wc\" flavors produce leading spaces","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-03-12T08:30:01Z","receivedAt":"2008-03-12T08:30:01Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <johannes.sixt@telecom.at>\n\nWe print the number of commits in parentheses, but without this change\nwe would get an oddly looking line like this:\n\n    * sm1 4c8d358...41fbea9 (      4):\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n\n\tHow portable is this?\n\n\t-- Hannes\n\n git-submodule.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex f7a6ee2..221a4c8 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -462,7 +462,7 @@ cmd_summary() {\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\ttotal_commits=\" ($(($total_commits + 0)))\"\n \t\t\t;;\n \t\tesac\n\n-- \n1.5.4.4.1329.g2c612\n"}]}