zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: git completion - pass on --git-dir option
@ 2016-09-30  7:12 Oliver Kiddle
  2016-10-04 17:26 ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2016-09-30  7:12 UTC (permalink / raw)
  To: Zsh workers

Various aspects of git completion don't work if the option --git-dir is
used. This solves that by putting the value in $GIT_DIR.

Oliver

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 2178b82..c89ab56 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -7484,7 +7484,7 @@ _git() {
         ;;
       (option-or-argument)
         curcontext=${curcontext%:*:*}:git-$words[1]:
-
+	(( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir]
 	if ! _call_function ret _git-$words[1]; then
 	  if zstyle -T :completion:$curcontext: use-fallback; then
 	    _default && ret=0


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

* Re: PATCH: git completion - pass on --git-dir option
  2016-09-30  7:12 PATCH: git completion - pass on --git-dir option Oliver Kiddle
@ 2016-10-04 17:26 ` Daniel Shahaf
  2016-10-16  0:54   ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2016-10-04 17:26 UTC (permalink / raw)
  To: Zsh workers

Oliver Kiddle wrote on Fri, Sep 30, 2016 at 09:12:55 +0200:
> Various aspects of git completion don't work if the option --git-dir is
> used. This solves that by putting the value in $GIT_DIR.
> 
> +++ b/Completion/Unix/Command/_git
> @@ -7484,7 +7484,7 @@ _git() {
> +	(( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir]

Also for --work-tree/GIT_WORK_TREE?

There are other --option/ENVVAR pairs in git(1), but I don't know
whether it is important for them to get this treatment too.

Cheers,

Daniel


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

* Re: PATCH: git completion - pass on --git-dir option
  2016-10-04 17:26 ` Daniel Shahaf
@ 2016-10-16  0:54   ` Daniel Shahaf
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-10-16  0:54 UTC (permalink / raw)
  To: Zsh workers

Daniel Shahaf wrote on Tue, Oct 04, 2016 at 17:26:23 +0000:
> Oliver Kiddle wrote on Fri, Sep 30, 2016 at 09:12:55 +0200:
> > Various aspects of git completion don't work if the option --git-dir is
> > used. This solves that by putting the value in $GIT_DIR.
> > 
> > +++ b/Completion/Unix/Command/_git
> > @@ -7484,7 +7484,7 @@ _git() {
> > +	(( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir]
> 
> Also for --work-tree/GIT_WORK_TREE?

This matters for diff-files.

> There are other --option/ENVVAR pairs in git(1), but I don't know
> whether it is important for them to get this treatment too.

-C would also be useful.  Given that it can be passed multiple times,
I think the best approach would be to define a local array in _git that
contains all the -C/--work-tree/--git-dir/--et-cetera options and their
arguments from the command-line, and pass it to various _call_program
invocations later in the file.

I don't plan to do this, though; I got quite enough on my plate right now.

Cheers,

Daniel


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

end of thread, other threads:[~2016-10-16  0:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30  7:12 PATCH: git completion - pass on --git-dir option Oliver Kiddle
2016-10-04 17:26 ` Daniel Shahaf
2016-10-16  0:54   ` 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).