completion: don't override given stash subcommand with -p
authorVille Skyttä <redacted>
Thu, 21 May 2020 18:35:59 +0000 (21:35 +0300)
committerJunio C Hamano <redacted>
Thu, 21 May 2020 19:55:33 +0000 (12:55 -0700)
commitfffd0cf520718fcd0315bc5e0ee7a6d4762b96b4
tree0caf9bfb16815a15b6c30d2886abc959db05b494
parentdf70b190bdd2add42a906819f9d41dbf91cf0809
completion: don't override given stash subcommand with -p

df70b190 (completion: make stash -p and alias for stash push -p,
2018-04-20) wanted to make sure "git stash -p <TAB>" offers the same
completion as "git stash push -p <TAB>", but it did so by forcing the
$subcommand to be "push" whenever then "-p" option is found on the
command line.

This harms any subcommand that can take the "-p" option---even when the
subcommand is explicitly given, e.g. "git stash show -p", the code added
by the change would overwrite the $subcommand the user gave us.

Fix it by making sure that the defaulting to "push" happens only when
there is no $subcommand given yet.

Signed-off-by: Ville Skyttä <redacted>
Signed-off-by: Junio C Hamano <redacted>
contrib/completion/git-completion.bash
git clone https://git.99rst.org/PROJECT