diff options
author | Jeff King <peff@peff.net> | 2015-05-20 14:17:46 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-20 13:47:41 -0700 |
commit | 5ba28313f29bcc2e8571c4b325646fecfbe238df (patch) | |
tree | 81cd6d6d4f3ec5a0e32bc43f75a5bda5fef2cb56 | |
parent | d6cc2df5c80dc4f52a56679baa5e32539eb028b1 (diff) | |
download | git-5ba28313f29bcc2e8571c4b325646fecfbe238df.tar.gz |
stash: recognize "--help" for subcommandsjk/stash-options
If you run "git stash --help", you get the help for stash
(this magic is done by the git wrapper itself). But if you
run "git stash drop --help", you get an error. We
cannot show help specific to "stash drop", of course, but we
can at least give the user the normal stash manpage.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | git-stash.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/git-stash.sh b/git-stash.sh index f540127da3..23bd1d3db2 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -219,6 +219,9 @@ save_stash () { -a|--all) untracked=all ;; + --help) + show_help + ;; --) shift break @@ -307,6 +310,11 @@ show_stash () { git diff ${FLAGS:---stat} $b_commit $w_commit } +show_help () { + exec git help stash + exit 1 +} + # # Parses the remaining options looking for flags and # at most one revision defaulting to ${ref_stash}@{0} @@ -373,6 +381,9 @@ parse_flags_and_rev() --index) INDEX_OPTION=--index ;; + --help) + show_help + ;; -*) test "$ALLOW_UNKNOWN_FLAGS" = t || die "$(eval_gettext "unknown option: \$opt")" |