zsh-workers
 help / color / mirror / code / Atom feed
* Curious result from "git" completion
@ 2013-04-04 17:44 Bart Schaefer
  2013-04-04 19:33 ` Nikolai Weibull
  2013-04-04 19:57 ` Curious result from "git" completion Frank Terbeck
  0 siblings, 2 replies; 10+ messages in thread
From: Bart Schaefer @ 2013-04-04 17:44 UTC (permalink / raw)
  To: zsh-workers

schaefer<502> git \'
Completing alias
'
Completing main porcelain command
[remainder suppressed]


What's with the solitary single quote being completed as an alias?

Note that I don't *have* any git aliases as far as I know, so if somebody
more git-savvy is going to try to reproduce this, you'll have to avoid
loading your regular git config.

Here's a bit of _complete_debug output:

: _git_commands:162; local -a aliases unique_aliases
: _git_commands:163; __git_extract_aliases
: __git_extract_aliases:1; aliases=: __git_extract_aliases:1:cmdsubst; _call_pro
gram aliases 'git config -z --get-regexp '\''^alias.'\'
: _call_program:3; local tmp
: _call_program:5:if; zstyle -s :completion::complete:git:argument-1:aliases com
mand tmp
: _call_program:12:else; eval 'git config -z --get-regexp '\''^alias.'\'
: (eval):1:else; git config -z --get-regexp '^alias.'
: __git_extract_aliases:1; aliases=( \' ) 


I was attempting completion in hopes of answering the question, "What's the
simple git equivalent of 'cvs export'?" to which I still have no answer.


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

* Re: Curious result from "git" completion
  2013-04-04 17:44 Curious result from "git" completion Bart Schaefer
@ 2013-04-04 19:33 ` Nikolai Weibull
  2013-04-05 15:19   ` Bart Schaefer
  2013-04-04 19:57 ` Curious result from "git" completion Frank Terbeck
  1 sibling, 1 reply; 10+ messages in thread
From: Nikolai Weibull @ 2013-04-04 19:33 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On Thu, Apr 4, 2013 at 7:44 PM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> schaefer<502> git \'
> Completing alias
> '

> What's with the solitary single quote being completed as an alias?

I’d assume that something’s going wrong in __git_extract_aliases, but
I can’t reproduce it.  Could the whole substitution in that function
somehow return an empty result that gets concatenated with the "\'" at
the end?

> I was attempting completion in hopes of answering the question, "What's the
> simple git equivalent of 'cvs export'?" to which I still have no answer.

What are you trying to achieve?  A simple cp -a on the main directory
followed by a rm -rf $DIR/.git would create a copy without any Git
information.  Otherwise, the archive sub-command may be of interest if
you’re packing a tree.


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

* Re: Curious result from "git" completion
  2013-04-04 17:44 Curious result from "git" completion Bart Schaefer
  2013-04-04 19:33 ` Nikolai Weibull
@ 2013-04-04 19:57 ` Frank Terbeck
  2013-04-07 18:33   ` Bart Schaefer
  1 sibling, 1 reply; 10+ messages in thread
From: Frank Terbeck @ 2013-04-04 19:57 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
[...]

Can't look at the completion issue right now, but I see Nikolai has
picked it up already.

> I was attempting completion in hopes of answering the question, "What's the
> simple git equivalent of 'cvs export'?" to which I still have no answer.

This would be "git archive".

The exact call depends on what you want to achieve. If you want an
export to deploy something you can do it like this:

 git archive master --format=tar --prefix=zsh-export/ | tar xvf -

Other possibilities depend on what you need.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


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

* Re: Curious result from "git" completion
  2013-04-04 19:33 ` Nikolai Weibull
@ 2013-04-05 15:19   ` Bart Schaefer
  2013-04-05 17:26     ` Frank Terbeck
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2013-04-05 15:19 UTC (permalink / raw)
  To: zsh-workers

On Apr 4,  9:33pm, Nikolai Weibull wrote:
} Subject: Re: Curious result from "git" completion
}
} I'd assume that something's going wrong in __git_extract_aliases, but
} I can't reproduce it.  Could the whole substitution in that function
} somehow return an empty result that gets concatenated with the "\'" at
} the end?

That seems to be it.  As I said, I don't have any aliases.


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

* Re: Curious result from "git" completion
  2013-04-05 15:19   ` Bart Schaefer
@ 2013-04-05 17:26     ` Frank Terbeck
  2013-04-05 17:54       ` [PATCH] _git: Handle zero defined aliases better Frank Terbeck
  0 siblings, 1 reply; 10+ messages in thread
From: Frank Terbeck @ 2013-04-05 17:26 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
[...]
> That seems to be it.  As I said, I don't have any aliases.

Interesting. Neither while or after I wrote the alias extraction thing
did I test the code without having aliases defined.

Luckily the effect is benign. ;)

I'll take a look right now.

Regards, Frank


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

* [PATCH] _git: Handle zero defined aliases better
  2013-04-05 17:26     ` Frank Terbeck
@ 2013-04-05 17:54       ` Frank Terbeck
  2013-04-05 20:06         ` Nikolai Weibull
  0 siblings, 1 reply; 10+ messages in thread
From: Frank Terbeck @ 2013-04-05 17:54 UTC (permalink / raw)
  To: zsh-workers

---

Come to think of it, I don't remember writing this. But I think this
will fix the issue.

 Completion/Unix/Command/_git | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 2b6a369..32d139a 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -4757,7 +4757,13 @@ __git_aliases () {
 
 (( $+functions[__git_extract_aliases] )) ||
 __git_extract_aliases () {
-  aliases=(${^${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}/$'\n'/:alias for \'}\')
+  local -a tmp
+  tmp=(${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.})
+  if (( ${#tmp} > 0 )); then
+      aliases=(${^tmp/$'\n'/:alias for \'}\')
+  else
+      aliases=()
+  fi
 }
 
 (( $+functions[__git_date_formats] )) ||
-- 
1.8.2.rc1


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

* Re: [PATCH] _git: Handle zero defined aliases better
  2013-04-05 17:54       ` [PATCH] _git: Handle zero defined aliases better Frank Terbeck
@ 2013-04-05 20:06         ` Nikolai Weibull
  2013-04-05 20:15           ` Frank Terbeck
  0 siblings, 1 reply; 10+ messages in thread
From: Nikolai Weibull @ 2013-04-05 20:06 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: zsh-workers

On Fri, Apr 5, 2013 at 7:54 PM, Frank Terbeck <ft@bewatermyfriend.org> wrote:

> Come to think of it, I don't remember writing this. But I think this
> will fix the issue.

I think I (re-)wrote __git_extract_aliases.  Is there no better way
than a temporary array?  I don’t quite see why it’s expanding to the
empty string in the first place.


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

* Re: [PATCH] _git: Handle zero defined aliases better
  2013-04-05 20:06         ` Nikolai Weibull
@ 2013-04-05 20:15           ` Frank Terbeck
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Terbeck @ 2013-04-05 20:15 UTC (permalink / raw)
  To: zsh-workers

Nikolai Weibull wrote:
[...]
> Is there no better way than a temporary array? I don’t quite see why
> it’s expanding to the empty string in the first place.

I looked around for a bit, but didn't find an elegant solution.

I don't think writing this bit a tad more explicitly is a bad thing. I
don't think this is performance sensitive and it might help with
debugging at another point in time.


Regards, Frank


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

* Re: Curious result from "git" completion
  2013-04-04 19:57 ` Curious result from "git" completion Frank Terbeck
@ 2013-04-07 18:33   ` Bart Schaefer
  2013-04-07 22:41     ` Aaron Schrab
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2013-04-07 18:33 UTC (permalink / raw)
  To: zsh-workers

Thanks for the patch for this.  Briefly switching to the other topic in
this thread (if this goes on much longer we should edit the Subject):

On Apr 4,  9:33pm, Nikolai Weibull wrote:
}
} > I was attempting completion in hopes of answering the question, "What's
} > the simple git equivalent of 'cvs export'?"
} 
} What are you trying to achieve?  A simple cp -a on the main directory
} followed by a rm -rf $DIR/.git would create a copy without any Git
} information.

That's what I was after.  I just assumed that since git seems to have a
sub-command for just about everything, there was probably already one
that did this in [what would appear to the user as] a single step, but
that I hadn't found it yet.

On Apr 4,  9:57pm, Frank Terbeck wrote:
}
} This would be "git archive".

Well, almost.  I still have to e.g. pipe it to tar.  But these are both
serviceable answers.


Background:  I have my own CVS repository with a slightly customized zsh
module.  It has stuff that's it's not really appropriate to push up to
sourceforge, e.g., Makefile changes to be able to compile the docs under
obsolete versions of texinfo, and the like.  I use it to pull sources
onto some hosts where git is not installed and it's a hassle to arrange
for it to be.  I have a script that previously sync'd CVS at sourceforge
into a local sandbox based on my repository, which I'm updating to base
the remote repository on git.  The sync depends on being able to do a
multi-way diff against a clean tree that has no version control clutter,
which until the cutover I would generate with "cvs export".

-- 
Barton E. Schaefer


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

* Re: Curious result from "git" completion
  2013-04-07 18:33   ` Bart Schaefer
@ 2013-04-07 22:41     ` Aaron Schrab
  0 siblings, 0 replies; 10+ messages in thread
From: Aaron Schrab @ 2013-04-07 22:41 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

At 11:33 -0700 07 Apr 2013, Bart Schaefer <schaefer@brasslantern.com> wrote:
>Background:  I have my own CVS repository with a slightly customized 
>zsh
>module.  It has stuff that's it's not really appropriate to push up to
>sourceforge, e.g., Makefile changes to be able to compile the docs under
>obsolete versions of texinfo, and the like.  I use it to pull sources
>onto some hosts where git is not installed and it's a hassle to arrange
>for it to be.  I have a script that previously sync'd CVS at sourceforge
>into a local sandbox based on my repository, which I'm updating to base
>the remote repository on git.  The sync depends on being able to do a
>multi-way diff against a clean tree that has no version control clutter,
>which until the cutover I would generate with "cvs export".

Another option for that may be to do a clone using the 
--separate-git-dir option to store the information that would normally 
be in .git someplace else.  That would create a .git file at the top 
level of the clone rather than the usual directory, so it wouldn't be 
completely clean but it would be very small with just a pointer to the 
actual repository location.  That has the benefit that such a clone is 
still completely usable with git commands.


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

end of thread, other threads:[~2013-04-07 22:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 17:44 Curious result from "git" completion Bart Schaefer
2013-04-04 19:33 ` Nikolai Weibull
2013-04-05 15:19   ` Bart Schaefer
2013-04-05 17:26     ` Frank Terbeck
2013-04-05 17:54       ` [PATCH] _git: Handle zero defined aliases better Frank Terbeck
2013-04-05 20:06         ` Nikolai Weibull
2013-04-05 20:15           ` Frank Terbeck
2013-04-04 19:57 ` Curious result from "git" completion Frank Terbeck
2013-04-07 18:33   ` Bart Schaefer
2013-04-07 22:41     ` Aaron Schrab

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