{"thread":{"id":"12432","subject":"[PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size","startedAt":"2008-03-02T18:15:07Z","lastAt":"2008-03-07T01:50:55Z","messageCount":13,"participants":["Ping Yin","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":4},"messages":[{"id":"70680","messageId":"1204481710-29791-1-git-send-email-pkufranky@gmail.com","threadId":"12432","inReplyTo":null,"subject":"[PATCH v3 1/4] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-02T18:15:07Z","receivedAt":"2008-03-02T18:15:07Z","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 HEAD) and working tree\n(or index, switched by --cached).\n\nThis patch just introduces the framework and shows submodules modified\nas follows.\n\n--------------------------------------------\n $ git submodule summary\n # Submodules modifiled: sm1 sm2 sm3 sm4 sm5\n #\n--------------------------------------------\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   66 +++++++++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 61 insertions(+), 5 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex a6aaf40..787d083 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@@ -320,7 +320,63 @@ 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+\t# TODO: quote module names containing space or tab\n+\ttest -n \"$modules\" &&\n+\techo \"# Submodules modified: \"$modules &&\n+\techo \"#\"\n+}\n #\n # List all submodules, prefixed with:\n #  - submodule not initialized\n@@ -391,7 +447,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@@ -406,7 +462,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@@ -430,8 +486,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\n"},{"id":"70682","messageId":"1204481710-29791-2-git-send-email-pkufranky@gmail.com","threadId":"12432","inReplyTo":"1204481710-29791-1-git-send-email-pkufranky@gmail.com","subject":"[PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-02T18:15:08Z","receivedAt":"2008-03-02T18:15:08Z","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 submodule in question, a series of commits will be shown as the path\nfrom the src commit to the dst commit, where the src commit is from the given\nsuper project commit, and the dst commit is from the index or working tree\n(switched by --cached).\n\nExample: commit summary for modified submodules sm1-sm5.\n--------------------------------------------\n $ git submodule summary\n # Submodules modifiled: sm1 sm2 sm3 sm4 sm5\n #\n # * sm1 354cd45...3f751e5:\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:\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):\n #   <one line message for G\n #\n # * sm5 354cd34(blob)->235efa(submodule):\n #   >one line message for H\n #\n--------------------------------------------\n\nsm1 has commit C as src (given commit or HEAD) and commit E as dst (index\nor working tree) as following picture shows.\n\t--A-->B-->C (in src:354cd45)\n\t  \\\n\t   -->D-->E (in dst:3f751e5)\n\nThe 'Submodules modified' section for sm1 shows how to change sm1 from\nsrc commit C to dst commit E: firstly backward (<) to commit A from\ncommit C via commit B, and then forward (>) to commit E via commit D.\n\nIllustration for output of deleted sm2 is similar.\n\nsm4 and sm5 are submodules with typechanging (blob<->submodule).\n\nIf the src/dst commit for a submodule is missing in the submodule\ndirectory, a warning will be issued (sm3 falls into this case)\nexcept in two cases where the submodule directory is deleted\n(type 'D') or typechanged to blob (one case of type 'T').\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 72 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 787d083..3313d6c 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -375,7 +375,78 @@ cmd_summary() {\n \t# TODO: quote module names containing space or tab\n \ttest -n \"$modules\" &&\n \techo \"# Submodules modified: \"$modules &&\n-\techo \"#\"\n+\techo \"#\" &&\n+\tgit diff-index $cache_option --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 \"$cache_option\" &&\n+\t\t\ttest $sha1_dst = 0000000000000000000000000000000000000000 &&\n+\t\t\t( GIT_DIR=\"$name/.git\" git rev-parse HEAD ) >/dev/null 2>&1\n+\t\tthen\n+\t\t\tsha1_dst=$(GIT_DIR=\"$name/.git\" git rev-parse HEAD)\n+\t\tfi\n+\t\tcheck_src=$(echo $mod_src | grep 160000)\n+\t\tcheck_dst=$(echo $mod_dst | grep 160000)\n+\t\terrmsg=\n+\t\tmissing_src=\n+\t\tmissing_dst=\n+\n+\t\ttest -z \"$check_src\" ||\n+\t\tGIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src >/dev/null 2>&1 ||\n+\t\tmissing_src=t\n+\n+\t\ttest -z \"$check_dst\" ||\n+\t\tGIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_dst >/dev/null 2>&1 ||\n+\t\tmissing_dst=t\n+\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\tleft=\n+\t\t\tright=\n+\t\t\ttest -n \"$check_src\" &&\n+\t\t\tleft=$(GIT_DIR=\"$name/.git\" git log --pretty=format:\"  <%s\" \\\n+\t\t\t${check_dst:+$sha1_dst..}$sha1_src 2>/dev/null)\n+\n+\t\t\ttest -n \"$check_dst\" &&\n+\t\t\tright=$(GIT_DIR=\"$name/.git\" git log --reverse --pretty=format:\"  >%s\" \\\n+\t\t\t${check_src:+$sha1_src..}$sha1_dst 2>/dev/null)\n+\t\t\t;;\n+\t\tesac\n+\n+\t\tsha1_src=$(echo $sha1_src | cut -c1-7)\n+\t\tsha1_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_src(blob)->$sha1_dst(submodule):\"\n+\t\t\telse\n+\t\t\t\techo \"* $name $sha1_src(submodule)->$sha1_dst(blob):\"\n+\t\t\tfi\n+\t\telse\n+\t\t\techo \"* $name $sha1_src...$sha1_dst:\"\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, i.e. deleted or changed to blob\n+\t\t\ttest $mod_dst = 160000 && echo \"$errmsg\"\n+\t\telse\n+\t\t\ttest -n \"$left\" && echo \"$left\"\n+\t\t\ttest -n \"$right\" && echo \"$right\"\n+\t\tfi\n+\t\techo\n+\tdone | sed -e 's/^/# /'\n }\n #\n # List all submodules, prefixed with:\n-- \n1.5.4.3.347.g5314c\n\n"},{"id":"70679","messageId":"1204481710-29791-3-git-send-email-pkufranky@gmail.com","threadId":"12432","inReplyTo":"1204481710-29791-1-git-send-email-pkufranky@gmail.com","subject":"[PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-02T18:15:09Z","receivedAt":"2008-03-02T18:15:09Z","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. Number 0 will disable\nsummary and minus number means unlimted (the default).\n\nFor beauty and clarification, the fork-point (i.e. the last commits for\nboth backward and forward sections) will always be shown disregarding the\ngiven limit. So actual summary size may be greater than the given limit.\n\n'git submodule summary -n 2 sm1' and 'git submodule summary -n 3 sm1'\nwill show the same in the super project mentioned in last patch.\n\n---------------------------------------\n $ git submodule summary -n 2 sm1\n # Submodules modifiled: sm1\n #\n # * sm1 354cd45...3f751e5:\n #   <one line message for C\n #   <one line message for B\n #   >...\n #   >one line message for E\n #\n---------------------------------------\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++--\n 1 files changed, 62 insertions(+), 3 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 3313d6c..dfd2952 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@@ -329,6 +331,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@@ -336,6 +340,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@@ -350,6 +363,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@@ -442,8 +457,52 @@ cmd_summary() {\n \t\t\t# Don't give error msg for modification whose dst is not submodule, i.e. deleted or changed to blob\n \t\t\ttest $mod_dst = 160000 && echo \"$errmsg\"\n \t\telse\n-\t\t\ttest -n \"$left\" && echo \"$left\"\n-\t\t\ttest -n \"$right\" && echo \"$right\"\n+\t\t\tlc0=0\n+\t\t\trc0=0\n+\t\t\ttest -n \"$left\" && lc0=$(echo \"$left\" | wc -l)\n+\t\t\ttest -n \"$right\" && rc0=$(echo \"$right\" | wc -l)\n+\n+\t\t\tif test $summary_limit -lt 0\n+\t\t\tthen\n+\t\t\t\tlc=$lc0\n+\t\t\t\trc=$rc0\n+\t\t\telif test $lc0 -lt $summary_limit\n+\t\t\tthen\n+\t\t\t\tlc=$lc0\n+\t\t\t\trc=$(($summary_limit-$lc))\n+\t\t\telse\n+\t\t\t\tlc=$summary_limit\n+\t\t\t\trc=1\n+\t\t\tfi\n+\n+\t\t\tif test $rc -gt $rc0\n+\t\t\tthen\n+\t\t\t\trc=$rc0\n+\t\t\tfi\n+\n+\t\t\tif test -n \"$left\"\n+\t\t\tthen\n+\t\t\t\tskip=$(($lc0-$lc))\n+\t\t\t\techo \"$left\" | head -$(($lc-1))\n+\t\t\t\tcase $skip in\n+\t\t\t\t\t0) : ;;\n+\t\t\t\t\t1) echo \"  <...\" ;;\n+\t\t\t\t\t*) echo \"  <... ($skip more)\" ;;\n+\t\t\t\tesac\n+\t\t\t\techo \"$left\" | tail -1\n+\t\t\tfi\n+\n+\t\t\tif test -n \"$right\"\n+\t\t\tthen\n+\t\t\t\tskip=$(($rc0-$rc))\n+\t\t\t\techo \"$right\" | head -$(($rc-1))\n+\t\t\t\tcase $skip in\n+\t\t\t\t\t0) : ;;\n+\t\t\t\t\t1) echo \"  <...\" ;;\n+\t\t\t\t\t*) echo \"  <... ($skip more)\" ;;\n+\t\t\t\tesac\n+\t\t\t\techo \"$right\" | tail -1\n+\t\t\tfi\n \t\tfi\n \t\techo\n \tdone | sed -e 's/^/# /'\n-- \n1.5.4.3.347.g5314c\n\n"},{"id":"70681","messageId":"1204481710-29791-4-git-send-email-pkufranky@gmail.com","threadId":"12432","inReplyTo":"1204481710-29791-1-git-send-email-pkufranky@gmail.com","subject":"[PATCH v3 4/4] git-submodule: New subcommand 'summary' (4) - Update the document","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-02T18:15:10Z","receivedAt":"2008-03-02T18:15:10Z","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 |   24 +++++++++++++++++++++---\n 1 files changed, 21 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex e818e6e..598e116 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@@ -46,6 +47,13 @@ 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 given commit (default to HEAD) and\n+\tworking tree/index. For a submodule in question, a series of commits\n+\twill be shown as the path from the src commit to the dst commit,\n+\twhere the src commit is from the given super project commit, and the\n+\tdst commit is from the index or working tree (switched by --cached).\n+\n \n OPTIONS\n -------\n@@ -56,9 +64,19 @@ 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 commands status and summary.\n+\tWhen combined with status, display the SHA-1 stored in the index,\n+\tnot the SHA-1 of the currently checked out submodule commit. When\n+\tcombined with summary, switch dst comparison side from working\n+\ttree to index.\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+\tNumber 0 will disable summary and minus number means unlimted\n+\t(the default). For beauty and clarification, the fork-point commits\n+\twill always be shown. So actual summary size may be greater than\n+\tthe given limit.\n \n <path>::\n \tPath to submodule(s). When specified this will restrict the command\n-- \n1.5.4.3.347.g5314c\n\n"},{"id":"71152","messageId":"7vk5kgiv0v.fsf@gitster.siamese.dyndns.org","threadId":"12432","inReplyTo":"1204481710-29791-2-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-05T23:57:36Z","receivedAt":"2008-03-05T23:57:36Z","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> Example: commit summary for modified submodules sm1-sm5.\n> --------------------------------------------\n>  $ git submodule summary\n>  # Submodules modifiled: sm1 sm2 sm3 sm4 sm5\n>  #\n>  # * sm1 354cd45...3f751e5:\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> \t--A-->B-->C (in src:354cd45)\n> \t  \\\n> \t   -->D-->E (in dst:3f751e5)\n\nThe ordering of the commits in the above list is (1) unnatural and (2)\ndoes not match what you would see with \"log --left-right --topo-order\nC...E\".\n\nI do not think \"it shows the path to move from C to E\" justifies it.  If\nyou are showing them as a linear list (which you cannot avoid if you are\ndoing a sequence of one-line description), you cannot represent such a\n\"path\" anyway (think \"merge\").  If an appliance project rebinds kernel/\npath from a project based on linux-2.4 to linux-2.6 while upgrading, such\na \"path\" may not even exist.\n\nI think I've already said the above to your initial round.  It is a bit\ndissapointing to see none of the comments were addressed and makes me\nwonder if I have wasted my time reviewing them again.\n\nIt also is unnerving that newly added and deleted submodule results in the\nfull history display.  It would be assuring to be able to see and verify\nwhat the top commit is (or was in \"deleted\" case) while you are commiting,\nbut I do not see a reason to show more than that.\n\nI do not think \"then set the limit to 1\" is a valid answer to that\nconcern.  Wanting to see a dozen top commits in each for a modified\nsubmodule would be sensible (and 3/4 may implement such a limit) but even\nthen showing dozen top commits for new/deleted at the same time would be\njust an added noise.  Is it really necessary to show more than the top for\nnew/deleted case?\n\n"},{"id":"71154","messageId":"7v7iggitsd.fsf@gitster.siamese.dyndns.org","threadId":"12432","inReplyTo":"1204481710-29791-3-git-send-email-pkufranky@gmail.com","subject":"Re: [PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-06T00:24:18Z","receivedAt":"2008-03-06T00:24:18Z","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 teaches git-submodule an option '--summary-limit|-n <number>'\n> to limit number of commits in total for the summary. Number 0 will disable\n> summary and minus number means unlimted (the default).\n\nI really doubt showing the bottom one specially makes sense.\n\nWhy not just read from\n\n\tgit log '--pretty=%m %h %s' --left-right --topo-order A...B\n\nand show N top commits from each?\n\nI've already said that I do not think applying the same limit to\nnew/deleted/modified cases makes sense, so commenting on this\npart might be a moot point, though.\n\n-- >8 --\n\n#!/bin/sh\n\nlimit=10\nA=cc/run-command\nB=jc/test\n\nlf='\n'\ngit log --pretty=format:%m\\ %h\\ %s --left-right $A...$B |\n(\n\tleft=0 right=0 l= r= llast= rlast=\n\tilimit=$(( $limit - 1 ))\n\twhile read leftright commit name\n\tdo\n\t\tit=\"$leftright$commit $name\"\n\t\tcase \"$leftright\" in\n\t\t'<')\n\t\t\tif test $left -eq $ilimit\n\t\t\tthen\n\t\t\t\tllast=$it\n\t\t\telif test $left -le $ilimit\n\t\t\tthen\n\t\t\t\tl=\"$l$it$lf\"\n\t\t\tfi\n\t\t\tleft=$(( $left + 1 ))\n\t\t\t;;\n\t\t'>')\n\t\t\tif test $right -eq $ilimit\n\t\t\tthen\n\t\t\t\trlast=$it\n\t\t\telif test $right -le $ilimit\n\t\t\tthen\n\t\t\t\tr=\"$r$it$lf\"\n\t\t\tfi\n\t\t\tright=$(( $right + 1 ))\n\t\t\t;;\n\t\tesac\n\tdone\n\n\tprintf %s \"$l\"\n\tif test $left -eq $limit\n\tthen\n\t\techo \"$llast\"\n\telif test $left -gt $limit\n\tthen\n\t\techo \"< (\"$(( $left - $limit ))\" more...)\"\n\tfi\n\tprintf %s \"$r\"\n\tif test $right -eq $limit\n\tthen\n\t\techo \"$rlast\"\n\telif test $right -gt $limit\n\tthen\n\t\techo \"> (\"$(( $right - $limit ))\" more...)\"\n\tfi\n)\n"},{"id":"71164","messageId":"46dff0320803051816x5b957da0m6396d31cad8b4116@mail.gmail.com","threadId":"12432","inReplyTo":"7vk5kgiv0v.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-06T02:16:23Z","receivedAt":"2008-03-06T02:16:23Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Thu, Mar 6, 2008 at 7:57 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ping Yin <pkufranky@gmail.com> writes:\n>\n>  > Example: commit summary for modified submodules sm1-sm5.\n> >       --A-->B-->C (in src:354cd45)\n>  >         \\\n>  >          -->D-->E (in dst:3f751e5)\n>\n>  The ordering of the commits in the above list is (1) unnatural and (2)\n>  does not match what you would see with \"log --left-right --topo-order\n>  C...E\".\n>\n>  I do not think \"it shows the path to move from C to E\" justifies it.  If\n>  you are showing them as a linear list (which you cannot avoid if you are\n>  doing a sequence of one-line description), you cannot represent such a\n>  \"path\" anyway (think \"merge\").  If an appliance project rebinds kernel/\n>  path from a project based on linux-2.4 to linux-2.6 while upgrading, such\n>  a \"path\" may not even exist.\n>\nGood point to show 'log --left-right --topo-order' is better\n\n>  I think I've already said the above to your initial round.  It is a bit\n>  dissapointing to see none of the comments were addressed and makes me\n>  wonder if I have wasted my time reviewing them again.\n\nSorry i lost your comments. Maybe it's a long time ago, i will revisit them.\n\n>\n>  It also is unnerving that newly added and deleted submodule results in the\n>  full history display.  It would be assuring to be able to see and verify\n>  what the top commit is (or was in \"deleted\" case) while you are commiting,\n>  but I do not see a reason to show more than that.\n>\n>  I do not think \"then set the limit to 1\" is a valid answer to that\n>  concern.  Wanting to see a dozen top commits in each for a modified\n>  submodule would be sensible (and 3/4 may implement such a limit) but even\n>  then showing dozen top commits for new/deleted at the same time would be\n>  just an added noise.  Is it really necessary to show more than the top for\n>  new/deleted case?\n>\nActually, not make much sense to show many commits in delete or add\ncase. I think showing 2 (the head and tail one) should make more sense\nsince the head one would be \"Initial add ...\" in many cases which\ndoesn't make much sense for the user.\n\nI will resend my patches after taking considering all of your\nsuggestion today or tommorow.\n\n\n\n-- \nPing Yin\n"},{"id":"71166","messageId":"46dff0320803051824t75f39524uda9bc864a9fe4435@mail.gmail.com","threadId":"12432","inReplyTo":"7v7iggitsd.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-06T02:24:45Z","receivedAt":"2008-03-06T02:24:45Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Thu, Mar 6, 2008 at 8:24 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ping Yin <pkufranky@gmail.com> writes:\n>\n>  > This patch teaches git-submodule an option '--summary-limit|-n <number>'\n>  > to limit number of commits in total for the summary. Number 0 will disable\n>  > summary and minus number means unlimted (the default).\n>\n>  I really doubt showing the bottom one specially makes sense.\n>\n>  Why not just read from\n>\n>         git log '--pretty=%m %h %s' --left-right --topo-order A...B\n>\n>  and show N top commits from each?\nI don't have strong point about this. This one sounds fine to me and\nwill make my patch much simpler.\n\n>\n>  I've already said that I do not think applying the same limit to\n>  new/deleted/modified cases makes sense, so commenting on this\n>  part might be a moot point, though.\n>\n\nHowabout a new option to limit the added/deleted case which default to 1 or 2?\n\n\n\n-- \nPing Yin\n"},{"id":"71172","messageId":"7v3ar4lcgf.fsf@gitster.siamese.dyndns.org","threadId":"12432","inReplyTo":"46dff0320803051816x5b957da0m6396d31cad8b4116@mail.gmail.com","subject":"Re: [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-06T04:10:24Z","receivedAt":"2008-03-06T04:10:24Z","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> ... I think showing 2 (the head and tail one) should make more sense\n> since the head one would be \"Initial add ...\" in many cases which\n> doesn't make much sense for the user.\n\nWhy would you want to see the bottom one?  I still don't understand.\n\nAnd I do not mean this as a rhetorical question.  I am here to learn and\nI would like to make sure that I do not make a suggestion based on wrong\nunderstanding of what the user wants to see.\n\nI probably am lacking imagination to think of a good use scenario that\nshowing the bottom one would be useful to the user, and you as the author\nof this patch must thought about what the user want much more than me.\n\n\n"},{"id":"71195","messageId":"46dff0320803052156u374d70c1i45f7789233beb32c@mail.gmail.com","threadId":"12432","inReplyTo":"7v3ar4lcgf.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-06T05:56:21Z","receivedAt":"2008-03-06T05:56:21Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Thu, Mar 6, 2008 at 12:10 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n>  > ... I think showing 2 (the head and tail one) should make more sense\n>\n> > since the head one would be \"Initial add ...\" in many cases which\n>  > doesn't make much sense for the user.\n>\n>  Why would you want to see the bottom one?  I still don't understand.\n>\n>  And I do not mean this as a rhetorical question.  I am here to learn and\n>  I would like to make sure that I do not make a suggestion based on wrong\n>  understanding of what the user wants to see.\n>\n>  I probably am lacking imagination to think of a good use scenario that\n>  showing the bottom one would be useful to the user, and you as the author\n>  of this patch must thought about what the user want much more than me.\n>\nShowing the bottom one can give the user an impression where\nthe submodules goes at first glance if the user is familiar with the\ndeveloping progress of the submodule.\n\nHowever, i don't have very strong point on this and just think it\nseems good when\ni type 'git log'  (i have make the summary go into the commit message)\n\n\n\n-- \nPing Yin\n"},{"id":"71222","messageId":"7vwsog9ls5.fsf@gitster.siamese.dyndns.org","threadId":"12432","inReplyTo":"46dff0320803052156u374d70c1i45f7789233beb32c@mail.gmail.com","subject":"Re: [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-06T10:42:02Z","receivedAt":"2008-03-06T10:42:02Z","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>>  Why would you want to see the bottom one?  I still don't understand.\n>>\n>>  And I do not mean this as a rhetorical question.  I am here to learn and\n>>  I would like to make sure that I do not make a suggestion based on wrong\n>>  understanding of what the user wants to see.\n>>\n>>  I probably am lacking imagination to think of a good use scenario that\n>>  showing the bottom one would be useful to the user, and you as the author\n>>  of this patch must thought about what the user want much more than me.\n>>\n> Showing the bottom one can give the user an impression where\n> the submodules goes at first glance if the user is familiar with the\n> developing progress of the submodule.\n\nI think you are talking about the top one (the latest commit), and we both\nknow that is interesting information to show.  I was asking about the most\nancient one, which often is \"Initial version of frotz.\"\n"},{"id":"71234","messageId":"46dff0320803060336o4a28e4e0ve5a3f17e1323e171@mail.gmail.com","threadId":"12432","inReplyTo":"7vwsog9ls5.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v3 2/4] git-submodule: New subcommand 'summary' (2) - show commit summary","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-06T11:36:50Z","receivedAt":"2008-03-06T11:36:50Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Thu, Mar 6, 2008 at 6:42 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n>\n> >>  Why would you want to see the bottom one?  I still don't understand.\n>  >>\n>  >>  And I do not mean this as a rhetorical question.  I am here to learn and\n>  >>  I would like to make sure that I do not make a suggestion based on wrong\n>  >>  understanding of what the user wants to see.\n>  >>\n>  >>  I probably am lacking imagination to think of a good use scenario that\n>  >>  showing the bottom one would be useful to the user, and you as the author\n>  >>  of this patch must thought about what the user want much more than me.\n>  >>\n>  > Showing the bottom one can give the user an impression where\n>  > the submodules goes at first glance if the user is familiar with the\n>  > developing progress of the submodule.\n>\n>  I think you are talking about the top one (the latest commit), and we both\n>  know that is interesting information to show.  I was asking about the most\n>  ancient one, which often is \"Initial version of frotz.\"\n>\nRight, we have misunderstood each other in the 'bottom'  word. I thought\nyou propose to keep the initial one, and i said the latest one make much\nsense than the initial one.\n\nNow we agree on that keeping the latest commit is enough.\n\n\n\n-- \nPing Yin\n"},{"id":"71305","messageId":"46dff0320803061750x70d059a2yaf1e5751e9c62150@mail.gmail.com","threadId":"12432","inReplyTo":"46dff0320803051824t75f39524uda9bc864a9fe4435@mail.gmail.com","subject":"Re: [PATCH v3 3/4] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-07T01:50:55Z","receivedAt":"2008-03-07T01:50:55Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Thu, Mar 6, 2008 at 10:24 AM, Ping Yin <pkufranky@gmail.com> wrote:\n> On Thu, Mar 6, 2008 at 8:24 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>  > Ping Yin <pkufranky@gmail.com> writes:\n>  >\n>  >  > This patch teaches git-submodule an option '--summary-limit|-n <number>'\n>  >  > to limit number of commits in total for the summary. Number 0 will disable\n>  >  > summary and minus number means unlimted (the default).\n>  >\n>  >  I really doubt showing the bottom one specially makes sense.\n>  >\n>  >  Why not just read from\n>  >\n>  >         git log '--pretty=%m %h %s' --left-right --topo-order A...B\n>  >\n>  >  and show N top commits from each?\n\nI doubt '%h' is useful and it may result in overlong message lines.\nIs '--topo-order' expensive when only show top N commits?\nI prefer to use\n\n    git log --pretty='format:%m %s' --left-right --first-parent A...B\n\nfor modificated modules, and\n\n   git log -1 --pretty='format:> %s' $sha1_dst\n   git log -1 --pretty='format:< %s' $sha1_src\n\nfor added ( or blob -> submodule typechange) and deleted\n( or submodule -> blob typechange) modules separately.\n\n\n\n\n-- \nPing Yin\n"}]}