git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 22, 2012, 17:58 UTC
Message-ID
<7vwr443xp3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<95877607-FED0-41C0-9F12-B91FE9DE7871@openforce.com>
Alexander Daniel <alexander.daniel@openforce.com> 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"
 			;;
Previous: Alexander Daniel
Message 2 of 2 in “[BUG] `git stash drop --help` removes stash”
  1. Alexander DanielMay 22, 2012
  2. Junio C HamanoMay 22, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.