{"thread":{"id":"3882","subject":"Support \"git cmd --help\" syntax","startedAt":"2006-04-15T18:13:49Z","lastAt":"2006-04-19T21:40:23Z","messageCount":5,"participants":["Linus Torvalds","Junio C Hamano","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"18705","messageId":"Pine.LNX.4.64.0604151054380.3701@g5.osdl.org","threadId":"3882","inReplyTo":null,"subject":"Support \"git cmd --help\" syntax","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-04-15T18:13:49Z","receivedAt":"2006-04-15T18:13:49Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nThe \"--help\" argument is special, in that it is (along with \"--version\") \nin that is taken by the \"git\" program itself rather than the sub-command, \nand thus we've had the syntax \"git --help cmd\".\n\nHowever, as anybody who has ever used CVS or some similar devil-spawn \nprogram, it's confusing as h*ll when options before the sub-command act \ndifferently from options after the sub-command, so this quick hack just \nmakes it acceptable to do \"git cmd --help\" instead, and get the exact same \nresult.\n\nIt may be hacky, but it's simple and does the trick.\n\nOf course, this does not help if you use one of the non-builtin commands \nwithout using the \"git\" helper. Ie you won't be getting a man-page just \nbecause you do \"git-rev-list --help\". Don't expect us to be quite _that_ \nhelpful.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/git.c b/git.c\nindex 78ed403..13c6d51 100644\n--- a/git.c\n+++ b/git.c\n@@ -411,6 +411,12 @@ static void handle_internal_command(int \n \t};\n \tint i;\n \n+\t/* Turn \"git cmd --help\" into \"git help cmd\" */\n+\tif (argc > 1 && !strcmp(argv[1], \"--help\")) {\n+\t\targv[1] = argv[0];\n+\t\targv[0] = cmd = \"help\";\n+\t}\n+\n \tfor (i = 0; i < ARRAY_SIZE(commands); i++) {\n \t\tstruct cmd_struct *p = commands+i;\n \t\tif (strcmp(p->cmd, cmd))\n"},{"id":"18713","messageId":"7vsloeef0k.fsf@assigned-by-dhcp.cox.net","threadId":"3882","inReplyTo":"Pine.LNX.4.64.0604151054380.3701@g5.osdl.org","subject":"Re: Support \"git cmd --help\" syntax","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-15T20:54:19Z","receivedAt":"2006-04-15T20:54:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> However, as anybody who has ever used CVS or some similar devil-spawn \n> program, it's confusing as h*ll when options before the sub-command act \n> differently from options after the sub-command, so this quick hack just \n> makes it acceptable to do \"git cmd --help\" instead, and get the exact same \n> result.\n>\n> It may be hacky, but it's simple and does the trick.\n\nTried \"git commit --help\" with and without the patch?\n\nI am not sure if we want to \"help\" migrants from CVS or some\nsimilar program by shooting ourselves in the foot.\n"},{"id":"18715","messageId":"Pine.LNX.4.64.0604151402470.3701@g5.osdl.org","threadId":"3882","inReplyTo":"7vsloeef0k.fsf@assigned-by-dhcp.cox.net","subject":"Re: Support \"git cmd --help\" syntax","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-04-15T21:07:21Z","receivedAt":"2006-04-15T21:07:21Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 15 Apr 2006, Junio C Hamano wrote:\n> \n> Tried \"git commit --help\" with and without the patch?\n\nI get a usage message without the patch.\n\nWith the patch, I get the man-page.\n\nIOW, I don't see your point.\n\nI'd have expected that to be an improvement. You can always get the usage \nmessage with \"git commit --huh?\", so it's not like you've lost anything.\n\nNow, if you have _not_ done\n\n\tmake prefix=/usr/share install-doc\n\nor similar, then yes, you get something less than helpful (along the lines \nof \"No manual entry for git-commit\"), and I agree that we could/should \nimprove on that somehow. \n\n\t\t\tLinus\n"},{"id":"18718","messageId":"7vd5fie2iv.fsf@assigned-by-dhcp.cox.net","threadId":"3882","inReplyTo":"Pine.LNX.4.64.0604151402470.3701@g5.osdl.org","subject":"Re: Support \"git cmd --help\" syntax","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-16T01:24:08Z","receivedAt":"2006-04-16T01:24:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> I'd have expected that to be an improvement. You can always get the usage \n> message with \"git commit --huh?\", so it's not like you've lost anything.\n\nFair enough.  I'd say I am convinced now.\n"},{"id":"18890","messageId":"e26anq$42t$1@sea.gmane.org","threadId":"3882","inReplyTo":"Pine.LNX.4.64.0604151402470.3701@g5.osdl.org","subject":"Re: Support \"git cmd --help\" syntax","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-04-19T21:40:23Z","receivedAt":"2006-04-19T21:40:23Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n\n> [...] You can always get the usage\n> message with \"git commit --huh?\", so it's not like you've lost anything.\n\nOr \"git commit --usage\".\n\n-- \nJakub Narebski\nWarsaw, Poland\n"}]}