{"thread":{"id":"22898","subject":"[PATCH 2/2] submodule summary: do not fail before the first commit","startedAt":"2010-03-03T22:19:09Z","lastAt":"2010-03-03T23:12:52Z","messageCount":4,"participants":["Junio C Hamano","Johan Herland"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"136111","messageId":"1267654750-30911-1-git-send-email-gitster@pobox.com","threadId":"22898","inReplyTo":null,"subject":"[PATCH 1/2] submodule summary: do not shift a non-existent positional variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-03T22:19:09Z","receivedAt":"2010-03-03T22:19:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nWhen \"git submodule summary\" is run without any argument, we default to\ncompare the state of index with the HEAD, but tried to shift out $1 that\ndoes not exist (and worse yet, we didn't use it).\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\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 5869c00..383dc45 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -556,7 +556,7 @@ cmd_summary() {\n \tif rev=$(git rev-parse -q --verify --default HEAD ${1+\"$1\"})\n \tthen\n \t\thead=$rev\n-\t\tshift\n+\t\ttest $# = 0 || shift\n \telif test -z \"$1\" -o \"$1\" = \"HEAD\"\n \tthen\n \t\treturn\n-- \n1.7.0.1.290.g2d87e\n"},{"id":"136110","messageId":"1267654750-30911-2-git-send-email-gitster@pobox.com","threadId":"22898","inReplyTo":"1267654750-30911-1-git-send-email-gitster@pobox.com","subject":"[PATCH 2/2] submodule summary: do not fail before the first commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-03T22:19:10Z","receivedAt":"2010-03-03T22:19:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When \"git status\" collects changes for the index (usually relative to\nHEAD), it compares the index with an empty tree when the repository does\nnot have an initial commit yet.  \"git submodule summary\" is about asking\nwhat submodule changes would be recorded if a commit is made right now,\nand should do the same comparison to report all the added submodules,\ninstead of punting and being silent.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-submodule.sh |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 383dc45..eab2549 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -559,7 +559,8 @@ cmd_summary() {\n \t\ttest $# = 0 || shift\n \telif test -z \"$1\" -o \"$1\" = \"HEAD\"\n \tthen\n-\t\treturn\n+\t\t# before the first commit: compare with an empty tree\n+\t\thead=$(git hash-object -w -t tree --stdin </dev/null)\n \telse\n \t\thead=\"HEAD\"\n \tfi\n-- \n1.7.0.1.290.g2d87e\n"},{"id":"136114","messageId":"201003040012.37412.johan@herland.net","threadId":"22898","inReplyTo":"1267654750-30911-1-git-send-email-gitster@pobox.com","subject":"Re: [PATCH 1/2] submodule summary: do not shift a non-existent positional variable","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2010-03-03T23:12:37Z","receivedAt":"2010-03-03T23:12:37Z","isPatch":true,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Wednesday 03 March 2010, Junio C Hamano wrote:\n> From: Jeff King <peff@peff.net>\n> \n> When \"git submodule summary\" is run without any argument, we default to\n> compare the state of index with the HEAD, but tried to shift out $1 that\n> does not exist (and worse yet, we didn't use it).\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nAcked-by: Johan Herland <johan@herland.net>\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"136115","messageId":"201003040012.52565.johan@herland.net","threadId":"22898","inReplyTo":"1267654750-30911-2-git-send-email-gitster@pobox.com","subject":"Re: [PATCH 2/2] submodule summary: do not fail before the first commit","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2010-03-03T23:12:52Z","receivedAt":"2010-03-03T23:12:52Z","isPatch":true,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Wednesday 03 March 2010, Junio C Hamano wrote:\n> When \"git status\" collects changes for the index (usually relative to\n> HEAD), it compares the index with an empty tree when the repository does\n> not have an initial commit yet.  \"git submodule summary\" is about asking\n> what submodule changes would be recorded if a commit is made right now,\n> and should do the same comparison to report all the added submodules,\n> instead of punting and being silent.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nAcked-by: Johan Herland <johan@herland.net>\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"}]}