{"thread":{"id":"31046","subject":"[PATCH] commit-tree: resurrect command line parsing updates","startedAt":"2012-07-17T20:22:13Z","lastAt":"2012-07-18T03:05:43Z","messageCount":2,"participants":["Junio C Hamano","Keshav Kini"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"195218","messageId":"7vd33uxhmy.fsf@alter.siamese.dyndns.org","threadId":"31046","inReplyTo":null,"subject":"[PATCH] commit-tree: resurrect command line parsing updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-17T20:22:13Z","receivedAt":"2012-07-17T20:22:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"79a9312 (commit-tree: update the command line parsing, 2011-11-09)\nupdated the command line parser to understand the usual \"flags first\nand then non-flag arguments\" order, in addition to the original and\na bit unusual \"tree comes first and then zero or more -p <parent>\".\n\nUnfortunately, ba3c69a (commit: teach --gpg-sign option, 2011-10-05)\nbroke it by mistake.  Resurrect it, and protect the feature with a\ntest from future breakages.\n\nNoticed by Keshav Kini <keshav.kini@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * I privately received a patch that is essentially the same from\n   Keshav, but I do not see it either on the list or on gmane.  I\n   suspect the message was sent via gmane's news submission\n   interface and probably it is taking some time propagating back to\n   the list, or something.\n\n   The patch in this message is with an updated log message and an\n   additional test. It is meant to apply to the 1.7.9.X maintenance\n   track and upwards.  For 1.7.11.1 and later, we also need to\n   revert d284367 (git-commit-tree(1): update synopsis, 2012-06-19),\n   which was done without realizing that the updated command line\n   argument order was lost by an earlier mistake.\n\n builtin/commit-tree.c          |  3 ---\n t/t1100-commit-tree-options.sh | 17 +++++++++++++++++\n 2 files changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex d5e19af..792670a 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -48,9 +48,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \tif (argc < 2 || !strcmp(argv[1], \"-h\"))\n \t\tusage(commit_tree_usage);\n \n-\tif (get_sha1(argv[1], tree_sha1))\n-\t\tdie(\"Not a valid object name %s\", argv[1]);\n-\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tif (!strcmp(arg, \"-p\")) {\ndiff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh\nindex c4414ff..a3b7723 100755\n--- a/t/t1100-commit-tree-options.sh\n+++ b/t/t1100-commit-tree-options.sh\n@@ -7,6 +7,9 @@ test_description='git commit-tree options test\n \n This test checks that git commit-tree can create a specific commit\n object by defining all environment variables that it understands.\n+\n+Also make sure that command line parser understands the normal\n+\"flags first and then non flag arguments\" command line.\n '\n \n . ./test-lib.sh\n@@ -42,4 +45,18 @@ test_expect_success \\\n     'compare commit' \\\n     'test_cmp expected commit'\n \n+\n+test_expect_success 'flags and then non flags' '\n+\techo comment text |\n+\tgit commit-tree $(cat treeid) >commitid &&\n+\techo comment text |\n+\tgit commit-tree $(cat treeid) -p $(cat commitid) >childid-1 &&\n+\techo comment text |\n+\tgit commit-tree -p $(cat commitid) $(cat treeid) >childid-2 &&\n+\ttest_cmp childid-1 childid-2 &&\n+\tgit commit-tree $(cat treeid) -m foo >childid-3 &&\n+\tgit commit-tree -m foo $(cat treeid) >childid-4 &&\n+\ttest_cmp childid-3 childid-4\n+'\n+\n test_done\n-- \n1.7.11.2.308.gd5eadba\n"},{"id":"195241","messageId":"87fw8p93aw.fsf@gmail.com","threadId":"31046","inReplyTo":"7vd33uxhmy.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] commit-tree: resurrect command line parsing updates","fromName":"Keshav Kini","fromEmail":"keshav.kini@gmail.com","sentAt":"2012-07-18T03:05:43Z","receivedAt":"2012-07-18T03:05:43Z","isPatch":true,"sender":{"key":"keshav.kini@gmail.com","avatar":"https://avatars.githubusercontent.com/u/691290?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n>  * I privately received a patch that is essentially the same from\n>    Keshav, but I do not see it either on the list or on gmane.  I\n>    suspect the message was sent via gmane's news submission\n>    interface and probably it is taking some time propagating back to\n>    the list, or something.\n\nI sent it over NNTP via Gnus, a newsreader application. I may have done\nsomething wrong, though, as I didn't get a \"acknowledge that you just\nsent a mail through Gmane\" message from Gmane, as I usually do when\nposting to a list I haven't posted to before.\n\nIn any case, I'm glad you got the CC :)\n\n-Keshav\n"}]}