Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion: git: mutual exclusive handling of patch diff options
- X-seq: zsh-workers 34816
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>
- Subject: Re: completion: git: mutual exclusive handling of patch diff options
- Date: Sun, 29 Mar 2015 08:23:40 +0000
- Cc: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=PkfNbsbSRaMMMmtK q/gaQUtUX0g=; b=Wrd2XRhZ90AHcIVE49KAhvYXkauAOQXo7R64MDvd08AVAcEe EURb4xn+TuvazOf4UU5+5RLgh+7JBjIFKZiIEFz8NqnQ7myDAlRM8lLXbhonEf+A 8abe8e6r1l6MzG44jk6InpovmwfLLCvSBANdOWft6YeIKQ2IbXwX8N7E3VU=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=PkfNbsbSRaMMMmt Kq/gaQUtUX0g=; b=DD3Hd6PTUmW5++JyS9HKolo8APx8tbsam7APtIBfSMT6yb+ 9bEQJzAoia6slQlsFVm759x8wx13s6RAYj0SExDmJjzccCbaENHFxug9WyOsKtK9 pGdEVVZrArTt62yvCBVSApXMxI7lDsIYU/A8IHHT+kYWcMQcgebVm6YK++cU=
- In-reply-to: <550F74E9.40909@thequod.de>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <550F74E9.40909@thequod.de>
Daniel Hahler wrote on Mon, Mar 23, 2015 at 03:05:29 +0100:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> __git_setup_diff_options makes the assumption that different options
> cannot be used together, based on:
>
> diff_types='(-p -u --patch -U --unified --raw --patch-with-raw --stat
> --numstat --shortstat --dirstat --dirstat-by-file --summary
> --patch-with-stat --name-only --name-status --cumulative -s
> --no-patch)'
>
> But "git diff --stat -p" is a useful combination, and Zsh will currently
> only complete "changed in working tree file" after this.
>
> I've noticed this because I've changed my "gd" alias to: "git diff
> - --submodule --stat -p"
>
> Options like "--name-only" can only be used alone, but there's also no
> error when using "-p" or "--stat" with it.
>
> For my alias I can use "--patch-with-stat" (instead of "-p --stat"), but
> then the completion would still be broken for "gd --no-patch" (in case
> you would not want a diff-stat once).
>
> I think the options shouldn't be mutual exclusive here in general, but
> only where it makes sense, e.g. "--name-only".
>
Agreed — '-p --stat' and '-p --stat --minimal' are valid combinations,
and so _git should support them.
I don't think we have to nail down the exact set of permitted
combinations, either; it would be better to have a false positive (offer
an option that is preempted by an earlier option on the command line)
than to have a false negative (not offer a valid option).
> It seems like the reason for only using "changed in working tree files" is
> that the previous word is not recognized as an option nor as a
> commit/blob/reference. Maybe that restriction could be also lifted to
> skip/ignore any arguments starting with a dash ("-"). Otherwise any new
> options to git-diff, which are not handled by the completion would cause
> the same problem when being used.
That's a general problem with completion, e.g., 'rsync --foo
-<TAB>' does nothing (not even an error). The completion code doesn't
know what to suggest because it doesn't know whether the --foobar option
takes an argument or not.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author