Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [BUG] `git stash drop --help` removes stash

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:52
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Alexander Daniel [off-list ref] writes:
SUMMARY
`git stash drop --help` removes stash@{0}
Thanks.

Unfortunately there is no subcommand specific help text, so a quick fix
would be along the lines of the attached patch.

The right fix would be to instead add support for subcommand specific help
text.  Such a change would tweak assert_stash_like and assert_stash_ref
not to die when --help is given even if there is no stash (or an explicit
command line argument did not name a stash), and then make all subcommand
implementations in the script (e.g. find places where these two functions
are called) notice that the user asked for --help and give subcommand
specific help text from there.


 git-stash.sh | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/git-stash.sh b/git-stash.sh
index 4e2c7f8..487e2b5 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -339,6 +339,9 @@ parse_flags_and_rev()
 			--index)
 				INDEX_OPTION=--index
 			;;
+			--help)
+				usage
+			;;
 			-*)
 				FLAGS="${FLAGS}${FLAGS:+ }$opt"
 			;;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help