{"thread":{"id":"53521","subject":"[PATCH] completion: fix completing stashes with \"show -p\"","startedAt":"2020-05-21T14:22:03Z","lastAt":"2020-05-21T18:31:38Z","messageCount":3,"participants":["Ville Skyttä","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"398359","messageId":"20200521142156.4717-1-ville.skytta@iki.fi","threadId":"53521","inReplyTo":null,"subject":"[PATCH] completion: fix completing stashes with \"show -p\"","fromName":"Ville Skyttä","fromEmail":"ville.skytta@iki.fi","sentAt":"2020-05-21T14:21:56Z","receivedAt":"2020-05-21T14:22:03Z","isPatch":true,"sender":{"key":"ville.skytta@iki.fi","avatar":"https://avatars.githubusercontent.com/u/109152?v=4"},"body":"Regression in df70b190bdd2add42a906819f9d41dbf91cf0809\n\nSigned-off-by: Ville Skyttä <ville.skytta@iki.fi>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 70ad04e1b2..8dc4ad0e0d 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2782,7 +2782,7 @@ _git_stash ()\n \tlocal save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'\n \tlocal subcommands='push list show apply clear drop pop create branch'\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands save\")\"\n-\tif [ -n \"$(__git_find_on_cmdline \"-p\")\" ]; then\n+\tif [ -z \"$subcommand\" -a -n \"$(__git_find_on_cmdline \"-p\")\" ]; then\n \t\tsubcommand=\"push\"\n \tfi\n \tif [ -z \"$subcommand\" ]; then\n-- \n2.27.0.rc1.dirty\n\n"},{"id":"398376","messageId":"xmqqo8qhrvrz.fsf@gitster.c.googlers.com","threadId":"53521","inReplyTo":"20200521142156.4717-1-ville.skytta@iki.fi","subject":"Re: [PATCH] completion: fix completing stashes with \"show -p\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-21T18:24:32Z","receivedAt":"2020-05-21T18:24:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ville Skyttä <ville.skytta@iki.fi> writes:\n\n> Regression in df70b190bdd2add42a906819f9d41dbf91cf0809\n\nThat's not very helpful to readers.\n\nSomething like this?  I am merely guessing why you thought this\nchange is a good one, but that is what the proposed log message\nis supposed to do.\n\n    df70b190 (completion: make stash -p and alias for stash push -p,\n    2018-04-20) wanted to make sure \"git stash -p <TAB>\" offers the same\n    completion as \"git stash push -p <TAB>\", but it did so by forcing\n    the $subcommand to be \"push\" whenever then \"-p\" option is found on\n    the command line.  \n\n    This harms any subcommand that can take the \"-p\" option---even when\n    the subcommand is explicitly given, e.g. \"git stash show -p\", the\n    code added by the change would overwrite the $subcommand the user\n    gave us.\n\n    Fix it by making sure that the defaulting to \"push\" happens only\n    when there is no $subcommand given yet.\n\nThanks.\n\n>\n> Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>\n> ---\n>  contrib/completion/git-completion.bash | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 70ad04e1b2..8dc4ad0e0d 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -2782,7 +2782,7 @@ _git_stash ()\n>  \tlocal save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'\n>  \tlocal subcommands='push list show apply clear drop pop create branch'\n>  \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands save\")\"\n> -\tif [ -n \"$(__git_find_on_cmdline \"-p\")\" ]; then\n> +\tif [ -z \"$subcommand\" -a -n \"$(__git_find_on_cmdline \"-p\")\" ]; then\n>  \t\tsubcommand=\"push\"\n>  \tfi\n>  \tif [ -z \"$subcommand\" ]; then\n"},{"id":"398378","messageId":"CABr9L5BzpA1fnVP7+wk62-MMrfb05LSu7egvn-enZb6cmMNt2Q@mail.gmail.com","threadId":"53521","inReplyTo":"xmqqo8qhrvrz.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] completion: fix completing stashes with \"show -p\"","fromName":"Ville Skyttä","fromEmail":"ville.skytta@iki.fi","sentAt":"2020-05-21T18:31:24Z","receivedAt":"2020-05-21T18:31:38Z","isPatch":true,"sender":{"key":"ville.skytta@iki.fi","avatar":"https://avatars.githubusercontent.com/u/109152?v=4"},"body":"On Thu, 21 May 2020 at 21:24, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Ville Skyttä <ville.skytta@iki.fi> writes:\n>\n> > Regression in df70b190bdd2add42a906819f9d41dbf91cf0809\n>\n> That's not very helpful to readers.\n>\n> Something like this?  I am merely guessing why you thought this\n> change is a good one, but that is what the proposed log message\n> is supposed to do.\n\nExcellent guess and wording. Will copy verbatim and re-submit.\n"}]}