{"thread":{"id":"30588","subject":"[BUG] `git stash drop --help` removes stash","startedAt":"2012-05-22T07:29:40Z","lastAt":"2012-05-22T17:58:00Z","messageCount":2,"participants":["Alexander Daniel","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191885","messageId":"95877607-FED0-41C0-9F12-B91FE9DE7871@openforce.com","threadId":"30588","inReplyTo":null,"subject":"[BUG] `git stash drop --help` removes stash","fromName":"Alexander Daniel","fromEmail":"alexander.daniel@openforce.com","sentAt":"2012-05-22T07:29:40Z","receivedAt":"2012-05-22T07:29:40Z","isPatch":false,"sender":{"key":"alexander.daniel@openforce.com","avatar":null},"body":"SUMMARY\n`git stash drop --help` removes stash@{0}\n\nVERSION\n$ git --version\ngit version 1.7.10.2\n\nSTEPS TO REPRODUCE\n- put something on the stash with `git stash`\n- Naively try to show help for `git stash drop` with `git stash drop --help`\n- `git stash drop --help` actually removes stash@{0}:\n\n  $ git stash drop --help\n  Dropped refs/stash@{0} (bfee7acd94b85e2b0bb5ef172893872140ba0520)\n\nEXPECTED BEHAVIOR:\nInvalid parameter error message is displayed (no modification of the stash)\n\nAlex\n"},{"id":"191913","messageId":"7vwr443xp3.fsf@alter.siamese.dyndns.org","threadId":"30588","inReplyTo":"95877607-FED0-41C0-9F12-B91FE9DE7871@openforce.com","subject":"Re: [BUG] `git stash drop --help` removes stash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-22T17:58:00Z","receivedAt":"2012-05-22T17:58:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander Daniel <alexander.daniel@openforce.com> writes:\n\n> SUMMARY\n> `git stash drop --help` removes stash@{0}\n\nThanks.\n\nUnfortunately there is no subcommand specific help text, so a quick fix\nwould be along the lines of the attached patch.\n\nThe right fix would be to instead add support for subcommand specific help\ntext.  Such a change would tweak assert_stash_like and assert_stash_ref\nnot to die when --help is given even if there is no stash (or an explicit\ncommand line argument did not name a stash), and then make all subcommand\nimplementations in the script (e.g. find places where these two functions\nare called) notice that the user asked for --help and give subcommand\nspecific help text from there.\n\n\n git-stash.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 4e2c7f8..487e2b5 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -339,6 +339,9 @@ parse_flags_and_rev()\n \t\t\t--index)\n \t\t\t\tINDEX_OPTION=--index\n \t\t\t;;\n+\t\t\t--help)\n+\t\t\t\tusage\n+\t\t\t;;\n \t\t\t-*)\n \t\t\t\tFLAGS=\"${FLAGS}${FLAGS:+ }$opt\"\n \t\t\t;;\n"}]}