git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Albert Astals Cid <albert.astals.cid@kdab.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] bash completion: Add --autostash and --no-autostash to pull
Date: Fri, 24 Nov 2017 19:09:02 +0100	[thread overview]
Message-ID: <20171124180902.31253-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <94455771.5s97AYBuGd@yoga>

> Ideally we should only autocomplete if pull has --rebase since
> they only work with it but could not figure out how to do that
> and the error message of doing git pull --autostash points out
> that you need --rebase so i guess it's good enough

You could use the completion script's __git_find_on_cmdline() helper
function to easily check whether the '--rebase' option is already
present on the command line.

Having said that, I don't think we should go there, it feels that's
trying to be overly and unnecessarily clever.  After all, the order of
command line options doesn't matter, and 'git pull --autostash
--rebase' is a perfectly legit command.


> Signed-off-by: Albert Astals Cid <albert.astals.cid@kdab.com>
> ---
>  contrib/completion/git-completion.bash | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-
> completion.bash
> index 539d7f84f..7ded58f38 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1923,6 +1923,7 @@ _git_pull ()
>  	--*)
>  		__gitcomp "
>  			--rebase --no-rebase
> +			--autostash --no-autostash
>  			$__git_merge_options
>  			$__git_fetch_options
>  		"
> -- 
> 2.15.0
> 
> 
> 

  reply	other threads:[~2017-11-24 18:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21 14:39 [PATCH] bash completion: Add --autostash and --no-autostash to pull Albert Astals Cid
2017-11-24 18:09 ` SZEDER Gábor [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-11-20 15:07 Albert Astals Cid
2017-11-20 23:14 ` Eric Sunshine
2017-11-21 14:39   ` Albert Astals Cid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171124180902.31253-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=albert.astals.cid@kdab.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).