Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: update git completion through git 2.13.2



Bart wrote:
> So I think we had a bit if discussion about this before, but:  Is
> there any reasonable way for _git to check whether the
> options/subcommands/etc. it completes are actually supported by the
> installed version of git ?  I'm likely to be running a
> recently-rebuilt zsh on hosts where git is tracking the version in the
> OS distribution, which is probably quite a bit behind the bleeding
> edge.

For most cases, we decided against doing this manually (with explicit
conditions comparing version numbers) long ago. I'd sooner spend time
updating more functions to support the latest versions than to add
handling for multiple old versions. Most users will have the opposite
problem to you. If it is particularly bothering you with git, one option
is to do a local build of git on the relevant machine (a few newish git
features have motivated me to do that).

The output of git <subcommand> -h is moderately regular so it might be
possible to do filtering based on that. subcommand filtering might also
be possible but I'm not entirely sure on the best way. For git, we also
have quite a few cases where there are options that assert defaults
where we should be checking git config to see what the configured
default is.

Another approach to this issue is having upstream software include their
own completion functions. This is becoming slightly more common anyway.
It has some advantages (such as this) and some disadvantages (such as if
they ignore my pull requests to update the function). I don't think it'd
be suitable with git but I wish git would remove the broken function
they do distribute which wraps the bash completion.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author