{"thread":{"id":"28294","subject":"[PATCH] send-email: add option -h","startedAt":"2011-09-03T17:06:13Z","lastAt":"2011-09-06T16:04:00Z","messageCount":4,"participants":["Clemens Buchacher","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"174794","messageId":"20110903170612.GA3536@ecki","threadId":"28294","inReplyTo":null,"subject":"[PATCH] send-email: add option -h","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2011-09-03T17:06:13Z","receivedAt":"2011-09-03T17:06:13Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Most other git commands print a synopsis when passed -h. Make\nsend-email do the same.\n\nSigned-off-by: Clemens Buchacher <drizzd@aon.at>\n---\n git-send-email.perl |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 98ab33a..4ac6931 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -275,7 +275,9 @@ $SIG{INT}  = \\&signal_handler;\n # Begin by accumulating all the variables (defined above), that we will end up\n # needing, first, from the command line:\n \n-my $rc = GetOptions(\"sender|from=s\" => \\$sender,\n+my $help;\n+my $rc = GetOptions(\"help|H|h\" => \\$help,\n+\t\t    \"sender|from=s\" => \\$sender,\n                     \"in-reply-to=s\" => \\$initial_reply_to,\n \t\t    \"subject=s\" => \\$initial_subject,\n \t\t    \"to=s\" => \\@initial_to,\n@@ -313,6 +315,7 @@ my $rc = GetOptions(\"sender|from=s\" => \\$sender,\n \t\t    \"force\" => \\$force,\n \t );\n \n+usage() if $help;\n unless ($rc) {\n     usage();\n }\n-- \n1.7.6.1\n"},{"id":"174884","messageId":"7vk49mbvlk.fsf@alter.siamese.dyndns.org","threadId":"28294","inReplyTo":"20110903170612.GA3536@ecki","subject":"Re: [PATCH] send-email: add option -h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-05T20:08:39Z","receivedAt":"2011-09-05T20:08:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n> Most other git commands print a synopsis when passed -h. Make\n> send-email do the same.\n>\n> Signed-off-by: Clemens Buchacher <drizzd@aon.at>\n> ...\n> +my $help;\n> +my $rc = GetOptions(\"help|H|h\" => \\$help,\n\nI do not think what the patch aims to do is wrong per-se, but\n\n $ git send-email --help\n\nalready shows the full documentation, and I find it is misleading to say\n\"help|H|h\" here to pretend as if a long-help is triggered with this\ncommand. For that matter, do we have any other place that accept -H for\nhelp?\n\nIOW, shouldn't this line be this instead?\n\n> +my $rc = GetOptions(\"h\" => \\$help,\n"},{"id":"174897","messageId":"20110906063236.GA4923@ecki","threadId":"28294","inReplyTo":"7vk49mbvlk.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: add option -h","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2011-09-06T06:32:36Z","receivedAt":"2011-09-06T06:32:36Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Mon, Sep 05, 2011 at 01:08:39PM -0700, Junio C Hamano wrote:\n> Clemens Buchacher <drizzd@aon.at> writes:\n> \n> > Most other git commands print a synopsis when passed -h. Make\n> > send-email do the same.\n> >\n> > Signed-off-by: Clemens Buchacher <drizzd@aon.at>\n> > ...\n> > +my $help;\n> > +my $rc = GetOptions(\"help|H|h\" => \\$help,\n> \n> I do not think what the patch aims to do is wrong per-se, but\n> \n>  $ git send-email --help\n> \n> already shows the full documentation, and I find it is misleading to say\n> \"help|H|h\" here to pretend as if a long-help is triggered with this\n> command. For that matter, do we have any other place that accept -H for\n> help?\n> \n> IOW, shouldn't this line be this instead?\n> \n> > +my $rc = GetOptions(\"h\" => \\$help,\n\nSure. I was just copy-pasting from git-svn.perl. And in fact I\n_was_ confused by the fact that it also seemed to allow --help, but\nin fact did not handle that case any different.\n\nJust found a few more places, so how about this on top?\n\n-->8--\nFrom: Clemens Buchacher <drizzd@aon.at>\nDate: Tue, 6 Sep 2011 08:27:13 +0200\nSubject: [PATCH] use -h for synopsis and --help for manpage consistently\n\nThe \"git cmd --help\" syntax is translated into \"git help cmd\" by\ngit.c. Do not pretend to handle such cases in any individual\ncommands.\n\nSigned-off-by: Clemens Buchacher <drizzd@aon.at>\n---\n git-cvsserver.perl  |    4 ++--\n git-pull.sh         |    2 +-\n git-send-email.perl |    2 +-\n git-svn.perl        |    2 +-\n 4 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 1b8bff2..6c5185e 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -109,14 +109,14 @@ my $usage =\n     \"    --strict-paths      : Don't allow recursing into subdirectories\\n\".\n     \"    --export-all        : Don't check for gitcvs.enabled in config\\n\".\n     \"    --version, -V       : Print version information and exit\\n\".\n-    \"    --help, -h, -H      : Print usage information and exit\\n\".\n+    \"    -h                  : Print usage information and exit\\n\".\n     \"\\n\".\n     \"<directory> ... is a list of allowed directories. If no directories\\n\".\n     \"are given, all are allowed. This is an additional restriction, gitcvs\\n\".\n     \"access still needs to be enabled by the gitcvs.enabled config option.\\n\".\n     \"Alternately, one directory may be specified in GIT_CVSSERVER_ROOT.\\n\";\n \n-my @opts = ( 'help|h|H', 'version|V',\n+my @opts = ( 'h', 'version|V',\n \t     'base-path=s', 'strict-paths', 'export-all' );\n GetOptions( $state, @opts )\n     or die $usage;\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 63da37b..f08372a 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -120,7 +120,7 @@ do\n \t--d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n \t\tdry_run=--dry-run\n \t\t;;\n-\t-h|--h|--he|--hel|--help|--help-|--help-a|--help-al|--help-all)\n+\t-h)\n \t\tusage\n \t\t;;\n \t*)\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 4ac6931..734356a 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -276,7 +276,7 @@ $SIG{INT}  = \\&signal_handler;\n # needing, first, from the command line:\n \n my $help;\n-my $rc = GetOptions(\"help|H|h\" => \\$help,\n+my $rc = GetOptions(\"h\" => \\$help,\n \t\t    \"sender|from=s\" => \\$sender,\n                     \"in-reply-to=s\" => \\$initial_reply_to,\n \t\t    \"subject=s\" => \\$initial_subject,\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 89f83fd..a019f55 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -294,7 +294,7 @@ read_git_config(\\%opts);\n if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {\n \tGetopt::Long::Configure('pass_through');\n }\n-my $rv = GetOptions(%opts, 'help|H|h' => \\$_help, 'version|V' => \\$_version,\n+my $rv = GetOptions(%opts, 'h' => \\$_help, 'version|V' => \\$_version,\n                     'minimize-connections' => \\$Git::SVN::Migration::_minimize,\n                     'id|i=s' => \\$Git::SVN::default_ref_id,\n                     'svn-remote|remote|R=s' => sub {\n-- \n1.7.6.1\n"},{"id":"174933","messageId":"7vty8pac9b.fsf@alter.siamese.dyndns.org","threadId":"28294","inReplyTo":"20110906063236.GA4923@ecki","subject":"Re: [PATCH] send-email: add option -h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-06T16:04:00Z","receivedAt":"2011-09-06T16:04:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n> Just found a few more places, so how about this on top?\n\nYeah, something like that, except for git-send-email bits on side instead,\nperhaps. There is no poing in adding a known bad version first and then\nfix with a follow-up ;-).\n\nAlso I notice that \"git-pull\" parses \"--help-all\" but does not seem to do\nanything useful (it gives the one-line \"Usage: \" message and exits with 0)\nwhich probably deserves a patch separate from other commands.\n"}]}