zsh-workers
 help / color / mirror / code / Atom feed
* completion: git: mutual exclusive handling of patch diff options
@ 2015-03-23  2:05 Daniel Hahler
  2015-03-29  8:23 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Hahler @ 2015-03-23  2:05 UTC (permalink / raw)
  To: Zsh Hackers' List

-----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".

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.


Regards,
Daniel.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iD8DBQFVD3TpfAK/hT/mPgARAhyaAJ9N5WNsYn5WBxHZ0TSSpjtGXxPdcgCg+5ff
Z2jKc9ic4emhOjEHtEDPEEs=
=jg4S
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-29  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23  2:05 completion: git: mutual exclusive handling of patch diff options Daniel Hahler
2015-03-29  8:23 ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).