{"thread":{"id":"12382","subject":"[PATCH v2 0/3] git-submodule: New subcommand 'summary'","startedAt":"2008-02-29T17:34:44Z","lastAt":"2008-03-07T18:46:15Z","messageCount":20,"participants":["Ping Yin","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"70401","messageId":"1204306487-15849-1-git-send-email-pkufranky@gmail.com","threadId":"12382","inReplyTo":null,"subject":"[PATCH v2 0/3] git-submodule: New subcommand 'summary'","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-02-29T17:34:44Z","receivedAt":"2008-02-29T17:34:44Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"This patch series introduces summary support for submodule.\n\n"},{"id":"70402","messageId":"80aa1c46ced6f0b92ca2fca3b917d383343b3161.1204306070.git.pkufranky@gmail.com","threadId":"12382","inReplyTo":"1204306487-15849-1-git-send-email-pkufranky@gmail.com","subject":"[PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-02-29T17:34:45Z","receivedAt":"2008-02-29T17:34:45Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"Following patches teach git-submodule a new subcommand 'summary' to show\ncommit summary of user-cared (i.e. checked out) submodules since a given\ncommit (default HEAD) of super project.\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\n.Example: a super project with modified/deleted/typechanged submodules sm1 to 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\nsm3 and sm4 are submodules with typechanging (blob<->submodule).\n\nIf the src/dst commit for a submodule is not found in the work tree (say\nthe submodule respository in the work tree), a warning will be issued.\nsm3 falls into this case.\n\nThis patch just gives the framework. It just finds the submodules to be\nshown as 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 |   70 ++++++++++++++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 66 insertions(+), 4 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex a6aaf40..8009a8d 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,69 @@ set_name_rev () {\n \t) )\n \ttest -z \"$revname\" || revname=\" ($revname)\"\n }\n+#\n+# Show commit summary for submodules in index or working tree relative to the given commit\n+#\n+# If '--cached' is given, show summary between index and given commit,\n+# or between working tree and given commit\n+#\n+# @ = [head counting commits from (default 'HEAD'),] requested paths (default to all)\n+#\n+cmd_summary()\n+{\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+\tcache_option=${cached:+--cached}\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+\tcwd=$(pwd)\n+\tcd_to_toplevel\n+\n+\t# Get modified modules cared by user\n+\tmodules=$(git diff $cache_option --raw $head -- \"$@\" |\n+\t\tgrep '^:160000\\|:[0-9]\\+ 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+\tcd \"$cwd\"\n+}\n #\n # List all submodules, prefixed with:\n #  - submodule not initialized\n@@ -391,7 +453,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@@ -430,8 +492,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":"70403","messageId":"d6e82710452985611fb75c9d32a1b772bf0cb529.1204306070.git.pkufranky@gmail.com","threadId":"12382","inReplyTo":"80aa1c46ced6f0b92ca2fca3b917d383343b3161.1204306070.git.pkufranky@gmail.com","subject":"[PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-02-29T17:34:46Z","receivedAt":"2008-02-29T17:34:46Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"This patch does the hard work of submodule summary and finally gives\noutput shown in last patch.\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 69 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 8009a8d..8322771 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -380,7 +380,75 @@ 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 $cache_option --raw $head -- $modules |\n+\tgrep '^:160000\\|:[0-9]\\+ 160000' |\n+\tcut -c2- |\n+\twhile read mod_src mod_dst sha1_src sha1_dst status name\n+\tdo\n+\t\tsha1_src=$(echo $sha1_src | sed -e 's/\\.\\.\\.//')\n+\t\tsha1_dst=$(echo $sha1_dst | sed -e 's/\\.\\.\\.//')\n+\t\tcheck_src=$(echo $mod_src | grep 160000)\n+\t\tcheck_dst=$(echo $mod_dst | grep 160000)\n+\t\terrmsg=\n+\t\tunfound_src=\n+\t\tunfound_dst=\n+\n+\t\ttest -z \"$check_src\" ||\n+\t\tGIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 ||\n+\t\tunfound_src=t\n+\n+\t\ttest -z \"$check_dst\" ||\n+\t\tGIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_dst^0 >/dev/null 2>&1 ||\n+\t\tunfound_dst=t\n+\n+\t\tcase \"$unfound_src,$unfound_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 \tcd \"$cwd\"\n }\n #\n-- \n1.5.4.3.347.g5314c\n\n"},{"id":"70404","messageId":"18af168b52a735c33612c9c9e4778d8b8bef1cbc.1204306070.git.pkufranky@gmail.com","threadId":"12382","inReplyTo":"d6e82710452985611fb75c9d32a1b772bf0cb529.1204306070.git.pkufranky@gmail.com","subject":"[PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-02-29T17:34:47Z","receivedAt":"2008-02-29T17:34:47Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"This patches teaches git-submodule an option '--summary-limit|-n <number>'\nto limit number of commits for the summary. Number 0 will disable summary\nand minus number will not limit the summary size.\n\nFor beauty and clarification, the last commit for each section (backward\nand forward) will always be shown disregarding the given limit. So actual\nsummary size may be greater than the given limit.\n\nIn the same super project of these patch series, 'git submodule -n 2\nsummary sm1' and 'git submodule -n 3 summary sm1' will show the same.\n\n---------------------------------------\n $ git submodule -n 2 summary sm1\n # Submodules modifiled: sm1\n #\n # * sm1 354cd45...3f751e5:\n #   <one line message for C\n #   <one line message for B\n #   >... (1 more)\n #   >one line message for E\n #\n---------------------------------------\n\nSigned-off-by: Ping Yin <pkufranky@gmail.com>\n---\n git-submodule.sh |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++--\n 1 files changed, 53 insertions(+), 3 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 8322771..64f1f5c 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 <number>] [<commit>]] \\\n+[--] [<path>...]\"\n OPTIONS_SPEC=\n . git-sh-setup\n require_work_tree\n@@ -330,6 +332,8 @@ set_name_rev () {\n #\n cmd_summary()\n {\n+\tsummary_limit=-1\n+\n \t# parse $args after \"submodule ... summary\".\n \twhile test $# -ne 0\n \tdo\n@@ -337,6 +341,14 @@ 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 test -z \"$2\" || echo \"$2\" | grep --quiet -v '^-\\?[0-9]\\+$'\n+\t\t\tthen\n+\t\t\t\tusage\n+\t\t\tfi\n+\t\t\tsummary_limit=\"$2\"\n+\t\t\tshift\n+\t\t\t;;\n \t\t--)\n \t\t\tshift\n \t\t\tbreak\n@@ -351,6 +363,8 @@ cmd_summary()\n \t\tshift\n \tdone\n \n+\ttest $summary_limit = 0 && return\n+\n \tcache_option=${cached:+--cached}\n \n \tif rev=$(git rev-parse --verify \"$1^0\" 2>/dev/null)\n@@ -443,8 +457,44 @@ 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 (( $summary_limit < 0 ))\n+\t\t\tthen\n+\t\t\t\tlc=$lc0\n+\t\t\t\trc=$rc0\n+\t\t\telif (( $lc0 < $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 (( $rc > $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\ttest $skip != 0 && echo \"  <... ($skip more)\"\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\ttest $skip != 0 && echo \"  >... ($skip more)\"\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":"70483","messageId":"7vk5km7vir.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"80aa1c46ced6f0b92ca2fca3b917d383343b3161.1204306070.git.pkufranky@gmail.com","subject":"Re: [PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-01T07:28:44Z","receivedAt":"2008-03-01T07:28:44Z","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> Following patches teach git-submodule a new subcommand 'summary' to show\n> commit summary of user-cared (i.e. checked out) submodules since a given\n> commit (default HEAD) of super project.\n>\n> For a submodule in question, a series of commits will be shown as the path\n> from the src commit to the dst commit, where the src commit is from the given\n> super project commit, and the dst commit is from the index or working tree\n> (switched by --cached).\n>\n> .Example: a super project with modified/deleted/typechanged submodules sm1 to sm5.\n\nOverlong lines.  What's the dot before \"Example\"?\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\nNice touch.  This can happen even there is no repository corruption.\nE.g. you can have a checkout of supermodule at a revision newer than your\nlast \"git fetch\" in sm3.\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> Illustration for output of deleted sm2 is similar.\n>\n> sm3 and sm4 are submodules with typechanging (blob<->submodule).\n\nAre they?  I think you meant 4 and 5.\n\n> This patch just gives the framework. It just finds the submodules to be\n> shown as follows.\n>\n> --------------------------------------------\n>  $ git submodule summary\n>  # Submodules modifiled: sm1 sm2 sm3 sm4 sm5\n>  #\n> --------------------------------------------\n\nProbably it would be a better organization to show only this in the commit\nlog message for [1/3] and describe how the output is enhanced in the log\nmessage of the commit as the code builds more .\n\n> @@ -320,7 +320,69 @@ set_name_rev () {\n>  \t) )\n>  \ttest -z \"$revname\" || revname=\" ($revname)\"\n>  }\n> +#\n> +# Show commit summary for submodules in index or working tree relative to the given commit\n> +#\n> +# If '--cached' is given, show summary between index and given commit,\n> +# or between working tree and given commit\n\nOverlong lines again.\n\n> +# @ = [head counting commits from (default 'HEAD'),] requested paths (default to all)\n> +#\n\nWhat's \"@ =\" convention?\n\n> +cmd_summary()\n> +{\n\nWe seem to have '{' on the same line for shell functions in our scripts.\n\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\nIf you do this \"cached=\"$1\" instead here, then you do not need to do ... \n\n> +\tcache_option=${cached:+--cached}\n\n... this.\n\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\nHmph, is showing diff with anything other than HEAD useful?  What happens\nif the user says \"git submodules status HAED\" by mistake?\n\n> +\n> +\tcwd=$(pwd)\n> +\tcd_to_toplevel\n> +\n> +\t# Get modified modules cared by user\n> +\tmodules=$(git diff $cache_option --raw $head -- \"$@\" |\n\nWhen scripting, please do not use \"git diff\" unless absolutely necessary.\nIts output is not meant for script consumption and can be made more \"user\nfriendly\" as user request comes in.  Instead, use \"git diff-index\" here.\n\n> +\t\tgrep '^:160000\\|:[0-9]\\+ 160000' |\n\nThis looks troublesome.\n\n - [0-9] is obviously wrong and [0-7] is what you meant;\n - \\| and \\+ are not BRE but GNU.\n\nIt probably is more portable if written like this:\n\n\tgrep -e '^:160000 ' -e '^:[0-7]* 160000 '\n\n> +\t# TODO: quote module names containing space or tab\n\nYeah, the scripted version is bound to have a lot of issues with funny\ncharacters, but let's not worry about it too much.  It is something we can\nfix later and more easily when we rewrite it in C (or Perl), but first get\nthe feature right and stable.\n\n> +\ttest -n \"$modules\" &&\n> +\techo \"# Submodules modified: \"$modules &&\n> +\techo \"#\"\n> +\tcd \"$cwd\"\n\nHmph, is there any point to try coming back there?  You could have even\ndone the cd-to-toplevel inside of $( ... ) construct which is run inside a\nsubshell, so...\n"},{"id":"70484","messageId":"7vabli7vhr.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"d6e82710452985611fb75c9d32a1b772bf0cb529.1204306070.git.pkufranky@gmail.com","subject":"Re: [PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-01T07:29:20Z","receivedAt":"2008-03-01T07:29:20Z","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 of submodule summary and finally gives\n> output shown in last patch.\n>\n> Signed-off-by: Ping Yin <pkufranky@gmail.com>\n> ---\n>  git-submodule.sh |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++++-\n>  1 files changed, 69 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 8009a8d..8322771 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -380,7 +380,75 @@ 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 $cache_option --raw $head -- $modules |\n> +\tgrep '^:160000\\|:[0-9]\\+ 160000' |\n> +\tcut -c2- |\n\nSame issues as before.  It might be worthwhile to write this part all in\nPerl, I suspect...\n\n> +\twhile read mod_src mod_dst sha1_src sha1_dst status name\n> +\tdo\n> +\t\tsha1_src=$(echo $sha1_src | sed -e 's/\\.\\.\\.//')\n> +\t\tsha1_dst=$(echo $sha1_dst | sed -e 's/\\.\\.\\.//')\n\nThis is unneeded if you used the right tool, i.e. diff-index.\n\n> +\t\tcheck_src=$(echo $mod_src | grep 160000)\n> +\t\tcheck_dst=$(echo $mod_dst | grep 160000)\n\nHuh?  Do you mean \"test $mod_src = ':160000'\" and such?\n\n> +\t\terrmsg=\n> +\t\tunfound_src=\n> +\t\tunfound_dst=\n\nPerhaps \"missing\" is a better word.\n\n> +\t\ttest -z \"$check_src\" ||\n> +\t\tGIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 ||\n> +\t\tunfound_src=t\n\nYou do not want to do ^0; you will not be bind a non-commit in gitlink\nentry anyway.\n"},{"id":"70485","messageId":"7v1w6u7vhf.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"18af168b52a735c33612c9c9e4778d8b8bef1cbc.1204306070.git.pkufranky@gmail.com","subject":"Re: [PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-01T07:29:32Z","receivedAt":"2008-03-01T07:29:32Z","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 patches teaches git-submodule an option '--summary-limit|-n <number>'\n> to limit number of commits for the summary. Number 0 will disable summary\n> and minus number will not limit the summary size.\n\n\"Negative means unlimited\" feels unnecessary.  Didn't you make \"unlimited\"\nthe default anyway?\n>\n> For beauty and clarification, the last commit for each section (backward\n> and forward) will always be shown disregarding the given limit. So actual\n> summary size may be greater than the given limit.\n>\n> In the same super project of these patch series, 'git submodule -n 2\n> summary sm1' and 'git submodule -n 3 summary sm1' will show the same.\n\nThis description is unclear.  Does \"-n 2\" tell \"show 2 commits from both\nside\", or \"show 2 in total\"?\n\n> ---------------------------------------\n>  $ git submodule -n 2 summary sm1\n>  # Submodules modifiled: sm1\n>  #\n>  # * sm1 354cd45...3f751e5:\n>  #   <one line message for C\n>  #   <one line message for B\n>  #   >... (1 more)\n>  #   >one line message for E\n>  #\n\nWhen you have room only for N lines, you might have to say (X more), but\nyou never need to say (1 more).  You can fit that omitted one item on that\nline instead of wasting that line to say (1 more).\n\nIt is unclear from the above illustration as the (1 more) is pointing at\nright without having anything newer than that, but I think you meant to do\nsomething like this:\n\n    <top\n    <second\n    <... (N more)\n    <bottom\n    >top\n    >second\n    >... (M more)\n    >bottom\n\nI guess fork-point may be interesting enough that showing the bottom one\nlike you did might make sense.  I am not convinced but we'll see.\n\n> +\t\t-n|--summary-limit)\n> +\t\t\tif test -z \"$2\" || echo \"$2\" | grep --quiet -v '^-\\?[0-9]\\+$'\n\n\\?\\+?????\n\n\tsummary_limit=$(expr \"$2\" : '[0-9][0-9]*$')\n\nor even\n\n\tif summary_limit=$(( $2 + 0 )) 2>/dev/null ||\n           test \"$2\" != \"$summary_limit\"\n\tthen\n\t\tusage\n\tfi\n\nperhaps.\n\n> +\t\t\tif (( $summary_limit < 0 ))\n\nDon't.  The first line of this script says \"#!/bin/sh\", not bash.\n"},{"id":"70505","messageId":"46dff0320803010227r5024d152g259a6a07a2441351@mail.gmail.com","threadId":"12382","inReplyTo":"7vk5km7vir.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-01T10:27:17Z","receivedAt":"2008-03-01T10:27:17Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":">\n>\n>  > +             grep '^:160000\\|:[0-9]\\+ 160000' |\n>\n>  This looks troublesome.\n>\n>   - [0-9] is obviously wrong and [0-7] is what you meant;\n>   - \\| and \\+ are not BRE but GNU.\n>\nman grep says\n In  basic regular expressions the metacharacters ?, +, {, |, (, and )\nlose their special meaning; instead use the backslashed versions \\?,\n\\+, \\{, \\|, \\(, and \\).\n\nDoen't it mean that '\\|' is BRE ?\n\n\n-- \nPing Yin\n"},{"id":"70506","messageId":"46dff0320803010228g2d4672c3qd0548133d43b11a@mail.gmail.com","threadId":"12382","inReplyTo":"46dff0320803010201q72a72et951e0a3f090684e4@mail.gmail.com","subject":"Re: [PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-01T10:28:14Z","receivedAt":"2008-03-01T10:28:14Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Mar 1, 2008 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:\n >\n > Ping Yin <pkufranky@gmail.com> writes:\n\n\n> > .Example: a super project with modified/deleted/typechanged submodules sm1 to sm5.\n >\n > Overlong lines.  What's the dot before \"Example\"?\n\n '.' is an asciitext syntax. Maybe i should not use it in a commit message.\n\n\n > >\n > > sm3 and sm4 are submodules with typechanging (blob<->submodule).\n >\n > Are they?  I think you meant 4 and 5.\n >\n\n oh, it's a typo\n\n\n >\n > > This patch just gives the framework. It just finds the submodules to be\n > > shown as follows.\n > >\n > > --------------------------------------------\n > >  $ git submodule summary\n > >  # Submodules modifiled: sm1 sm2 sm3 sm4 sm5\n > >  #\n > > --------------------------------------------\n >\n > Probably it would be a better organization to show only this in the commit\n > log message for [1/3] and describe how the output is enhanced in the log\n > message of the commit as the code builds more .\n >\n\n Nice suggestion. Should i move most text into man page instead of in\n commit message?\n\n\n\n >\n > > +# @ = [head counting commits from (default 'HEAD'),] requested\npaths (default to all)\n > > +#\n >\n > What's \"@ =\" convention?\n typo again, should be $@\n\n\n >\n > > +cmd_summary()\n > > +{\n >\n > We seem to have '{' on the same line for shell functions in our scripts.\n >\n ok\n\n >\n > > +     # parse $args after \"submodule ... summary\".\n\n> > +     while test $# -ne 0\n > > +     do\n > > +             case \"$1\" in\n > > +             --cached)\n > > +                     cached=1\n > > +                     ;;\n >\n > If you do this \"cached=\"$1\" instead here, then you do not need to do ...\n >\n > > +     cache_option=${cached:+--cached}\n >\n > ... this.\n >\n --cached may be passed before 'summary' subcommand. So in the outer\n option parsing should i replace cached=1 to cached=$1 just in this\n patch or in another patch?\n\n >\n > > +\n > > +     if rev=$(git rev-parse --verify \"$1^0\" 2>/dev/null)\n\n> > +     then\n > > +             head=$rev\n > > +             shift\n > > +     else\n > > +             head=HEAD\n > > +     fi\n >\n > Hmph, is showing diff with anything other than HEAD useful?  What happens\n > if the user says \"git submodules status HAED\" by mistake?\n >\n s/status/summary ?\n This patch has nothing to do with git submodule status.\n 'git submodule summary' and 'git submodule summary HEAD' is equivalent\n\n Except HEAD, HEAD^ is neccessary. Since my target is to call 'git\n submodule summary' in wt-status.c and teach git-status and git-commit\n show this summary. So when 'git commit --amend', 'git submodule\n summary HEAD^' should be used.\n >\n > > +\n > > +     cwd=$(pwd)\n\n> > +     cd_to_toplevel\n > > +\n > > +     # Get modified modules cared by user\n > > +     modules=$(git diff $cache_option --raw $head -- \"$@\" |\n >\n > When scripting, please do not use \"git diff\" unless absolutely necessary.\n > Its output is not meant for script consumption and can be made more \"user\n > friendly\" as user request comes in.  Instead, use \"git diff-index\" here.\n\n ok\n\n\n >\n > > +     test -n \"$modules\" &&\n\n> > +     echo \"# Submodules modified: \"$modules &&\n > > +     echo \"#\"\n > > +     cd \"$cwd\"\n >\n > Hmph, is there any point to try coming back there?  You could have even\n > done the cd-to-toplevel inside of $( ... ) construct which is run inside a\n > subshell, so...\n >\n Hmm,  just to avoid side effect of this function.  I'll put 'cd' into\n the subshell\n\n\n\n --\n Ping Yin\n"},{"id":"70508","messageId":"46dff0320803010229h17b810a7k26d0ac36cf1eaef6@mail.gmail.com","threadId":"12382","inReplyTo":"46dff0320803010216m1bd20674if82d2d2072858290@mail.gmail.com","subject":"Re: [PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-01T10:29:26Z","receivedAt":"2008-03-01T10:29:26Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n > Ping Yin <pkufranky@gmail.com> writes:\n >\n >  > This patches teaches git-submodule an option '--summary-limit|-n <number>'\n >  > to limit number of commits for the summary. Number 0 will disable summary\n >  > and minus number will not limit the summary size.\n >\n >  \"Negative means unlimited\" feels unnecessary.  Didn't you make \"unlimited\"\n >  the default anyway?\n 'unlimited' is the default, i should clarify this in the message.\n\n I think 'Negative means unlimited' is neccessary. Someone may override\n --summary-limit in the shell alias, but sometime he may want to  bring\n back the unlimited behavior in the command line.\n\n\n > >\n >  > For beauty and clarification, the last commit for each section (backward\n >  > and forward) will always be shown disregarding the given limit. So actual\n >  > summary size may be greater than the given limit.\n >  >\n >  > In the same super project of these patch series, 'git submodule -n 2\n >  > summary sm1' and 'git submodule -n 3 summary sm1' will show the same.\n >\n >  This description is unclear.  Does \"-n 2\" tell \"show 2 commits from both\n >  side\", or \"show 2 in total\"?\n >\n I should make it clear that -n means 'in total'.\n\n>\n >  > ---------------------------------------\n >  >  $ git submodule -n 2 summary sm1\n >  >  # Submodules modifiled: sm1\n >  >  #\n >  >  # * sm1 354cd45...3f751e5:\n >  >  #   <one line message for C\n >  >  #   <one line message for B\n >  >  #   >... (1 more)\n >  >  #   >one line message for E\n >  >  #\n >\n >  When you have room only for N lines, you might have to say (X more), but\n >  you never need to say (1 more).  You can fit that omitted one item on that\n >  line instead of wasting that line to say (1 more).\n >\n make sense.\n\n\n >\n >  > +             -n|--summary-limit)\n\n>  > +                     if test -z \"$2\" || echo \"$2\" | grep --quiet -v '^-\\?[0-9]\\+$'\n >\n >  \\?\\+?????\n >\n >         summary_limit=$(expr \"$2\" : '[0-9][0-9]*$')\n >\n >  or even\n >\n >         if summary_limit=$(( $2 + 0 )) 2>/dev/null ||\n >            test \"$2\" != \"$summary_limit\"\n >         then\n >                 usage\n >         fi\n >\n >  perhaps.\n >\n >  > +                     if (( $summary_limit < 0 ))\n >\n >  Don't.  The first line of this script says \"#!/bin/sh\", not bash.\n >\n ok, i'll fix it.\n\n\n\n --\n Ping Yin\n"},{"id":"70510","messageId":"46dff0320803010304i7c9593f0l48620c4a3518314@mail.gmail.com","threadId":"12382","inReplyTo":"7vabli7vhr.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-01T11:04:12Z","receivedAt":"2008-03-01T11:04:12Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ping Yin <pkufranky@gmail.com> writes:\n>\n>\n>  > +             check_src=$(echo $mod_src | grep 160000)\n>  > +             check_dst=$(echo $mod_dst | grep 160000)\n>\n>  Huh?  Do you mean \"test $mod_src = ':160000'\" and such?\n>\nYeah. There are 2 places needing test this. I don't find a better way\n\n\n-- \nPing Yin\n"},{"id":"70517","messageId":"46dff0320803010442y12c1326dk45f53ce17453b53c@mail.gmail.com","threadId":"12382","inReplyTo":"7v1w6u7vhf.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-01T12:42:46Z","receivedAt":"2008-03-01T12:42:46Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ping Yin <pkufranky@gmail.com> writes:\n\n>\n>  > +             -n|--summary-limit)\n>  > +                     if test -z \"$2\" || echo \"$2\" | grep --quiet -v '^-\\?[0-9]\\+$'\n>\n>  \\?\\+?????\n>\n>         summary_limit=$(expr \"$2\" : '[0-9][0-9]*$')\n>\nexpr is portable?\n\n>  or even\n>\n>         if summary_limit=$(( $2 + 0 )) 2>/dev/null ||\n>            test \"$2\" != \"$summary_limit\"\n>         then\n>                 usage\n>         fi\n>\n\nsummary_limit=$(( $2 + 0 )) will always has return status 0\nSo i use\n            summary_limit=$(($2 + 0))\n            if test $summary_limit = 0 -a \"$2\" != 0\n            then\n                usage\n            fi\n\n\n\n\n-- \nPing Yin\n"},{"id":"70554","messageId":"7vpruexkbd.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"46dff0320803010442y12c1326dk45f53ce17453b53c@mail.gmail.com","subject":"Re: [PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-01T20:26:14Z","receivedAt":"2008-03-01T20:26:14Z","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 Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> expr is portable?\n\nIt's not just portable but is a very old fashioned and time-proven way to\ndo things like this.\n\n>>         if summary_limit=$(( $2 + 0 )) 2>/dev/null ||\n>>            test \"$2\" != \"$summary_limit\"\n>>         then\n>>                 usage\n>>         fi\n>>\n>\n> summary_limit=$(( $2 + 0 )) will always has return status 0\n\nAh, there's a typo there.  The intention was to reject non numbers\n\n\tfor two in 43 -32 'deadbeef' ' -27' HEAD ''\n        do\n\t\tif sl=$(( $two + 0 )) 2>/dev/null && test \"$two\" == \"$sl\"\n                then\n                \techo Ah, \"$two\", that is a number.\n\t\telse\n                \techo You gave me an un-number \"'$two' (vs '$sl')\".\n\t\tfi\n\tdone\n"},{"id":"70556","messageId":"7vejauxj38.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"46dff0320803010227r5024d152g259a6a07a2441351@mail.gmail.com","subject":"Re: [PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-01T20:52:43Z","receivedAt":"2008-03-01T20:52:43Z","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>>  > +             grep '^:160000\\|:[0-9]\\+ 160000' |\n>>\n>>  This looks troublesome.\n>>\n>>   - [0-9] is obviously wrong and [0-7] is what you meant;\n>>   - \\| and \\+ are not BRE but GNU.\n>>\n> man grep says\n>  In  basic regular expressions the metacharacters ?, +, {, |, (, and )\n> lose their special meaning; instead use the backslashed versions \\?,\n> \\+, \\{, \\|, \\(, and \\).\n>\n> Doen't it mean that '\\|' is BRE ?\n\nIt just says unlike in ERE, these characters are not special in BRE; it\ndoes not at all say using backslash like \\?, \\+, and \\| makes them so.\n\nAnd they are not.  \\(...\\), \\{m\\}, \\{m,\\} and \\{m,n\\} are part of BRE, but\nthe two you used (\\+ and \\|) are not.  GNU accept these two as extensions,\nbut other POSIX implementations may have troubles with them.\n\n  http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html\n\nPlease be gentle to porters to non GNU systems.  Either stay inside BRE\n(which I think we have managed to do with our usage of grep) or explicitly\nask for ERE with \"grep -E\".\n"},{"id":"70570","messageId":"7vskz9x44d.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"7vejauxj38.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-02T02:16:02Z","receivedAt":"2008-03-02T02:16:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n> ...\n>> man grep says\n>>  In  basic regular expressions the metacharacters ?, +, {, |, (, and )\n>> lose their special meaning; instead use the backslashed versions \\?,\n>> \\+, \\{, \\|, \\(, and \\).\n>>\n>> Doen't it mean that '\\|' is BRE ?\n>\n> It just says unlike in ERE, these characters are not special in BRE; it\n> does not at all say using backslash like \\?, \\+, and \\| makes them so.\n>\n> And they are not.  \\(...\\), \\{m\\}, \\{m,\\} and \\{m,n\\} are part of BRE, but\n> the two you used (\\+ and \\|) are not.  GNU accept these two as extensions,\n> but other POSIX implementations may have troubles with them.\n>\n>   http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html\n>\n> Please be gentle to porters to non GNU systems.  Either stay inside BRE\n> (which I think we have managed to do with our usage of grep) or explicitly\n> ask for ERE with \"grep -E\".\n\nI think this would help people new to our codebase.\n\nAlso \n\n    Message-ID: <7v4pdtgjf0.fsf@gitster.siamese.dyndns.org>\n    Subject: Re: [PATCH] git-filter-branch could be confused by similar names\n    Date: Fri, 04 Jan 2008 17:17:39 -0800\n\naka\n\n    http://article.gmane.org gmane.comp.version-control.git/69630\n\n---\n\n Documentation/CodingGuidelines |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex 3b042db..994eb91 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -53,6 +53,18 @@ For shell scripts specifically (not exhaustive):\n  - We do not write the noiseword \"function\" in front of shell\n    functions.\n \n+ - As to use of grep, stick to a subset of BRE (namely, no \\{m,n\\},\n+   [::], [==], nor [..]) for portability.\n+\n+   - We do not use \\{m,n\\};\n+\n+   - We do not use -E;\n+\n+   - We do not use ? nor + (which are \\{0,1\\} and \\{1,\\}\n+     respectively in BRE) but that goes without saying as these\n+     are ERE elements not BRE (note that \\? and \\+ are not even part\n+     of BRE -- making them accessible from BRE is a GNU extension).\n+\n For C programs:\n \n  - We use tabs to indent, and interpret tabs as taking up to\n"},{"id":"70576","messageId":"46dff0320803012111nfc1c005k51edfee4c4c75520@mail.gmail.com","threadId":"12382","inReplyTo":"7vejauxj38.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/3] git-submodule: New subcommand 'summary' (1) - code framework","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-02T05:11:45Z","receivedAt":"2008-03-02T05:11:45Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sun, Mar 2, 2008 at 4:52 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n>\n>\n> >>  > +             grep '^:160000\\|:[0-9]\\+ 160000' |\n>  >>\n>  >>  This looks troublesome.\n>  >>\n>  >>   - [0-9] is obviously wrong and [0-7] is what you meant;\n>  >>   - \\| and \\+ are not BRE but GNU.\n>  >>\n>  > man grep says\n>  >  In  basic regular expressions the metacharacters ?, +, {, |, (, and )\n>  > lose their special meaning; instead use the backslashed versions \\?,\n>  > \\+, \\{, \\|, \\(, and \\).\n>  >\n>  > Doen't it mean that '\\|' is BRE ?\n>\n>  It just says unlike in ERE, these characters are not special in BRE; it\n>  does not at all say using backslash like \\?, \\+, and \\| makes them so.\n>\n>  And they are not.  \\(...\\), \\{m\\}, \\{m,\\} and \\{m,n\\} are part of BRE, but\n>  the two you used (\\+ and \\|) are not.  GNU accept these two as extensions,\n>  but other POSIX implementations may have troubles with them.\n>\n>   http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html\n>\n>  Please be gentle to porters to non GNU systems.  Either stay inside BRE\n>  (which I think we have managed to do with our usage of grep) or explicitly\n>  ask for ERE with \"grep -E\".\n>\nok, 3x.\n\n\n-- \nPing Yin\n"},{"id":"71356","messageId":"46dff0320803070850w290bfbe6hcdf74b20fcd7d8a4@mail.gmail.com","threadId":"12382","inReplyTo":"7vabli7vhr.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-07T16:50:01Z","receivedAt":"2008-03-07T16:50:01Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ping Yin <pkufranky@gmail.com> writes:\n>\n>  > +             test -z \"$check_src\" ||\n>  > +             GIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 ||\n>  > +             unfound_src=t\n>\n>  You do not want to do ^0; you will not be bind a non-commit in gitlink\n>  entry anyway.\n>\nActually, i need ^0. \"git-rev-parse --verify sha1\" will always succeed\nif sha1 is an valid\nname with lenght 40 even if the sha1 doesn't belong to the repository.\nBut what i want\nto verify is that the sha1 is not just valid/unique but also belongs\nto the submodule\nrepository.\n\n\n-- \nPing Yin\n"},{"id":"71358","messageId":"m34pbih3m9.fsf@localhost.localdomain","threadId":"12382","inReplyTo":"46dff0320803070850w290bfbe6hcdf74b20fcd7d8a4@mail.gmail.com","subject":"Re: [PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-03-07T16:59:30Z","receivedAt":"2008-03-07T16:59:30Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Ping Yin\" <pkufranky@gmail.com> writes:\n\n> On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Ping Yin <pkufranky@gmail.com> writes:\n>>\n>>> +             test -z \"$check_src\" ||\n>>> +             GIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 ||\n>>> +             unfound_src=t\n>>\n>>  You do not want to do ^0; you will not be bind a non-commit in gitlink\n>>  entry anyway.\n>>\n> Actually, I need ^0. \"git-rev-parse --verify sha1\" will always\n> succeed if sha1 is an valid name with lenght 40 even if the sha1\n> doesn't belong to the repository.\n>\n> But what I want to verify is that the sha1 is not just valid/unique\n> but also belongs to the submodule repository.\n\nDon't you want \"git cat-file -e <sha1>\" then, unless you are checking\nmore than one sha1?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"71364","messageId":"46dff0320803071023v48146536m9489db6c9a401824@mail.gmail.com","threadId":"12382","inReplyTo":"m34pbih3m9.fsf@localhost.localdomain","subject":"Re: [PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-07T18:23:28Z","receivedAt":"2008-03-07T18:23:28Z","isPatch":true,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Mar 8, 2008 at 12:59 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n>  > On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>  >> Ping Yin <pkufranky@gmail.com> writes:\n>  >>\n>  >>> +             test -z \"$check_src\" ||\n>  >>> +             GIT_DIR=\"$name/.git\" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 ||\n>  >>> +             unfound_src=t\n>  >>\n>  >>  You do not want to do ^0; you will not be bind a non-commit in gitlink\n>  >>  entry anyway.\n>  >>\n>  > Actually, I need ^0. \"git-rev-parse --verify sha1\" will always\n>  > succeed if sha1 is an valid name with lenght 40 even if the sha1\n>  > doesn't belong to the repository.\n>  >\n>  > But what I want to verify is that the sha1 is not just valid/unique\n>  > but also belongs to the submodule repository.\n>\n>  Don't you want \"git cat-file -e <sha1>\" then, unless you are checking\n>  more than one sha1?\n>\nHmm, yeah, the command you give has the same effect with\n   \"git-rev-parse --verify sha1^0\"\n>  --\n>  Jakub Narebski\n>  Poland\n>  ShadeHawk on #git\n>\n\n\n\n-- \nPing Yin\n"},{"id":"71370","messageId":"7vwsoe1ifc.fsf@gitster.siamese.dyndns.org","threadId":"12382","inReplyTo":"46dff0320803070850w290bfbe6hcdf74b20fcd7d8a4@mail.gmail.com","subject":"Re: [PATCH v2 2/3] git-submodule: New subcommand 'summary' (2) - hard work","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T18:46:15Z","receivedAt":"2008-03-07T18:46:15Z","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> Actually, i need ^0....\n> But what i want > to verify is that the sha1 is not just valid/unique\n> but also belongs to the submodule repository.\n\nAh, I missed that.  Thanks for the clarification.\n\n"}]}