threads / patch / 53788

patchFix zsh installation instructions

Subject: [PATCH] Fix zsh installation instructions

## tl;dr

17 messages between Jul 2, 2020 and Nov 3, 2020. Diffs are folded; open one to read it.

replies: 16people: 5as markdown or json

Alexey via GitGitGadget· Jul 2, 2020, 10:51 UTC · lore
From: Alexey <lesha.ogonkov@gmail.com>
- Fix wrong script in completion configuration. zsh wants bash completion
  path here, not path to itself.
- Add `compinit` autoload command, since whole thing didn't work
  if it is not loaded.
Signed-off-by: Alexey <lesha.ogonkov@gmail.com>
---
    Fix zsh installation instructions
    
     * Fix wrong script in completion configuration. zsh wants bash
       completion path here, not path to itself.
     * Add compinit autoload command, since whole thing didn't work if it is
       not loaded.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-814%2Fogonkov%2Fpatch-1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-814/ogonkov/patch-1-v1
Pull-Request: https://github.com/git/git/pull/814
 contrib/completion/git-completion.zsh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to contrib/completion/git-completion.zsh +2 −1
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index ce47e86b60..107869036d 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -9,13 +9,14 @@
 #
 # If your script is somewhere else, you can configure it on your ~/.zshrc:
 #
-#  zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
+#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
 #
 # The recommended way to install this script is to make a copy of it in
 # ~/.zsh/ directory as ~/.zsh/git-completion.zsh and then add the following
 # to your ~/.zshrc file:
 #
 #  fpath=(~/.zsh $fpath)
+#  autoload -Uz compinit && compinit
 
 complete ()
 {

base-commit: a08a83db2bf27f015bec9a435f6d73e223c21c5e
-- 
gitgitgadget
Junio C Hamano· Jul 6, 2020, 22:42 UTC · re: Alexey via GitGitGadget · lore

Re: [PATCH] Fix zsh installation instructions

> From: Alexey <lesha.ogonkov@gmail.com>
Thanks.
Any zsh users raise their hands?  Does this change look sane?
Show 43 quoted lines
> - Fix wrong script in completion configuration. zsh wants bash completion
>   path here, not path to itself.
> - Add `compinit` autoload command, since whole thing didn't work
>   if it is not loaded.
>
> Signed-off-by: Alexey <lesha.ogonkov@gmail.com>
> ---
>     Fix zsh installation instructions
>     
>      * Fix wrong script in completion configuration. zsh wants bash
>        completion path here, not path to itself.
>      * Add compinit autoload command, since whole thing didn't work if it is
>        not loaded.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-814%2Fogonkov%2Fpatch-1-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-814/ogonkov/patch-1-v1
> Pull-Request: https://github.com/git/git/pull/814
>
>  contrib/completion/git-completion.zsh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
> index ce47e86b60..107869036d 100644
> --- a/contrib/completion/git-completion.zsh
> +++ b/contrib/completion/git-completion.zsh
> @@ -9,13 +9,14 @@
>  #
>  # If your script is somewhere else, you can configure it on your ~/.zshrc:
>  #
> -#  zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
> +#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
>  #
>  # The recommended way to install this script is to make a copy of it in
>  # ~/.zsh/ directory as ~/.zsh/git-completion.zsh and then add the following
>  # to your ~/.zshrc file:
>  #
>  #  fpath=(~/.zsh $fpath)
> +#  autoload -Uz compinit && compinit
>  
>  complete ()
>  {
>
> base-commit: a08a83db2bf27f015bec9a435f6d73e223c21c5e
Stefan Haller· Oct 14, 2020, 15:10 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix zsh installation instructions

On 07.07.20 0:42, Junio C Hamano wrote:
Show 5 quoted lines
>> From: Alexey <lesha.ogonkov@gmail.com>
> 
> Thanks.
> 
> Any zsh users raise their hands?  Does this change look sane?
Sorry for the late reply, I only saw this now.

Yes, the change is sane. The wrong file extension (.zsh vs. .bash) was a documentation bug that I had noticed myself, but forgot to submit a patch for.

The other hunk (adding compinit) is not so important to me; I suppose it was not in the original version because most zsh users already have this in their .zshrc anyway. But it's not wrong, and doesn't hurt to have here, I guess.

Best, Stefan

Show 44 quoted lines
>> - Fix wrong script in completion configuration. zsh wants bash completion
>>    path here, not path to itself.
>> - Add `compinit` autoload command, since whole thing didn't work
>>    if it is not loaded.
>>
>> Signed-off-by: Alexey <lesha.ogonkov@gmail.com>
>> ---
>>      Fix zsh installation instructions
>>      
>>       * Fix wrong script in completion configuration. zsh wants bash
>>         completion path here, not path to itself.
>>       * Add compinit autoload command, since whole thing didn't work if it is
>>         not loaded.
>>
>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-814%2Fogonkov%2Fpatch-1-v1
>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-814/ogonkov/patch-1-v1
>> Pull-Request: https://github.com/git/git/pull/814
>>
>>   contrib/completion/git-completion.zsh | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
>> index ce47e86b60..107869036d 100644
>> --- a/contrib/completion/git-completion.zsh
>> +++ b/contrib/completion/git-completion.zsh
>> @@ -9,13 +9,14 @@
>>   #
>>   # If your script is somewhere else, you can configure it on your ~/.zshrc:
>>   #
>> -#  zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
>> +#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
>>   #
>>   # The recommended way to install this script is to make a copy of it in
>>   # ~/.zsh/ directory as ~/.zsh/git-completion.zsh and then add the following
>>   # to your ~/.zshrc file:
>>   #
>>   #  fpath=(~/.zsh $fpath)
>> +#  autoload -Uz compinit && compinit
>>   
>>   complete ()
>>   {
>>
>> base-commit: a08a83db2bf27f015bec9a435f6d73e223c21c5e
> 
Junio C Hamano· Oct 16, 2020, 17:06 UTC · re: Stefan Haller · lore

Re: [PATCH] Fix zsh installation instructions

Stefan Haller <lists@haller-berlin.de> writes:
Show 15 quoted lines
> On 07.07.20 0:42, Junio C Hamano wrote:
>>> From: Alexey <lesha.ogonkov@gmail.com>
>> Thanks.
>> Any zsh users raise their hands?  Does this change look sane?
>
> Sorry for the late reply, I only saw this now.
>
> Yes, the change is sane. The wrong file extension (.zsh vs. .bash) was
> a documentation bug that I had noticed myself, but forgot to submit a 
> patch for.
>
> The other hunk (adding compinit) is not so important to me; I suppose
> it was not in the original version because most zsh users already have
> this in their .zshrc anyway. But it's not wrong, and doesn't hurt to
> have here, I guess.
Thanks.  Will queue.
Felipe Contreras· Oct 25, 2020, 03:29 UTC · re: Stefan Haller · lore

Re: [PATCH] Fix zsh installation instructions

On Wed, Oct 14, 2020 at 12:39 PM Stefan Haller <lists@haller-berlin.de> wrote:
> Yes, the change is sane. The wrong file extension (.zsh vs. .bash) was a
> documentation bug that I had noticed myself, but forgot to submit a
> patch for.
Yes, a patch was wrongly applied that changed it from .sh to .zsh.
> The other hunk (adding compinit) is not so important to me; I suppose it
> was not in the original version because most zsh users already have this
> in their .zshrc anyway. But it's not wrong, and doesn't hurt to have
> here, I guess.

If you don't have compinit, then how is the '_git' script being loaded in the first place?

-- 
Felipe Contreras
Stefan Haller· Oct 27, 2020, 08:29 UTC · re: Felipe Contreras · lore

Re: [PATCH] Fix zsh installation instructions

On 25.10.20 4:29, Felipe Contreras wrote:
Show 16 quoted lines
> On Wed, Oct 14, 2020 at 12:39 PM Stefan Haller <lists@haller-berlin.de> wrote:
> 
>> Yes, the change is sane. The wrong file extension (.zsh vs. .bash) was a
>> documentation bug that I had noticed myself, but forgot to submit a
>> patch for.
> 
> Yes, a patch was wrongly applied that changed it from .sh to .zsh.
> 
>> The other hunk (adding compinit) is not so important to me; I suppose it
>> was not in the original version because most zsh users already have this
>> in their .zshrc anyway. But it's not wrong, and doesn't hurt to have
>> here, I guess.
> 
> If you don't have compinit, then how is the '_git' script being loaded
> in the first place?
> 
Stefan Haller· Oct 27, 2020, 08:32 UTC · re: Felipe Contreras · lore

Re: [PATCH] Fix zsh installation instructions

On 25.10.20 4:29, Felipe Contreras wrote:
Show 7 quoted lines
>> The other hunk (adding compinit) is not so important to me; I suppose it
>> was not in the original version because most zsh users already have this
>> in their .zshrc anyway. But it's not wrong, and doesn't hurt to have
>> here, I guess.
> 
> If you don't have compinit, then how is the '_git' script being loaded
> in the first place?

I didn't say it's unnecessary to have it in your .zshrc. I just said it's maybe unnecessary to document it here because most zsh users have it in their .zshrc already anyway.

(Sorry for the other empty mail, I hit the wrong button...)

Best, Stefan

Лёша Огоньков· Oct 27, 2020, 08:59 UTC · re: Stefan Haller · lore

Re: [PATCH] Fix zsh installation instructions

As an inexperienced zsh user it took me ages to understand why the whole thing is not working.

Regards Alexey

On Tue, 27 Oct 2020 at 11:32, Stefan Haller <lists@haller-berlin.de> wrote:
Show 18 quoted lines
>
> On 25.10.20 4:29, Felipe Contreras wrote:
> >> The other hunk (adding compinit) is not so important to me; I suppose it
> >> was not in the original version because most zsh users already have this
> >> in their .zshrc anyway. But it's not wrong, and doesn't hurt to have
> >> here, I guess.
> >
> > If you don't have compinit, then how is the '_git' script being loaded
> > in the first place?
>
> I didn't say it's unnecessary to have it in your .zshrc. I just said
> it's maybe unnecessary to document it here because most zsh users have
> it in their .zshrc already anyway.
>
> (Sorry for the other empty mail, I hit the wrong button...)
>
> Best,
> Stefan
Junio C Hamano· Oct 27, 2020, 20:00 UTC · re: Лёша Огоньков · lore

Re: [PATCH] Fix zsh installation instructions

Лёша Огоньков  <lesha.ogonkov@gmail.com> writes:
Show 17 quoted lines
> On Tue, 27 Oct 2020 at 11:32, Stefan Haller <lists@haller-berlin.de> wrote:
>>
>> On 25.10.20 4:29, Felipe Contreras wrote:
>> >> The other hunk (adding compinit) is not so important to me; I suppose it
>> >> was not in the original version because most zsh users already have this
>> >> in their .zshrc anyway. But it's not wrong, and doesn't hurt to have
>> >> here, I guess.
>> >
>> > If you don't have compinit, then how is the '_git' script being loaded
>> > in the first place?
>>
>> I didn't say it's unnecessary to have it in your .zshrc. I just said
>> it's maybe unnecessary to document it here because most zsh users have
>> it in their .zshrc already anyway.
>
> As an inexperienced zsh user it took me ages to understand why the
> whole thing is not working.

So,... even though it may look to more experienced zsh users that it is unnecessary to document it in this file, in your opinion, it is a good idea to mention "compinit" to help less experienced users?

In any case, the patch in question is the only thing in flight that conflicts with Felipe's 29 patch series, and the change to zstyle line is common between both efforts, so it is just between adding the "autoload -Uz compinit && compinit" near the fpath=(...) thing or leaving it out.

I'll let those who know zsh to figure it out. I suspect that the resolution would be either to ask Felipe to rebase his on yours, rebase yours on top of Felipe's, or just drop yours (if "autoload" thing is unnecessary as Stefan suspects---I cannot tell what Felipe wants to suggest by his response, between "unless you have compinit you wouldn't be using this script so why write it?" and "your users need to be taught about the need _somehow_, so why not make this the place to do so?").

Thanks.
Felipe Contreras· Oct 28, 2020, 01:45 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix zsh installation instructions

On Tue, Oct 27, 2020 at 2:00 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Лёша Огоньков  <lesha.ogonkov@gmail.com> writes:
> So,... even though it may look to more experienced zsh users that it
> is unnecessary to document it in this file, in your opinion, it is a
> good idea to mention "compinit" to help less experienced users?

The first time you run zsh you are greeted with a configuration dialog that includes this question:

--- The new completion system (compsys) allows you to complete commands, arguments and special shell syntax such as variables. It provides completions for a wide range of commonly used commands in most cases simply by typing the TAB key. Documentation is in the zshcompsys manual page. If it is not turned on, only a few simple completions such as filenames are available but the time to start the shell is slightly shorter.

You can:
  (1)  Turn on completion with the default options.
  (2)  Run the configuration tool (compinstall).  You can also run
       this from the command line with the following commands:
        autoload -Uz compinstall
        compinstall
       if you don't want to configure completion now.
  (0)  Don't turn on completion.
---
If you don't turn on completion, the completion doesn't work for *any* command.

I think most users would understand why git completion doesn't work if completion doesn't work for any command.

Show 5 quoted lines
> In any case, the patch in question is the only thing in flight that
> conflicts with Felipe's 29 patch series, and the change to zstyle
> line is common between both efforts, so it is just between adding
> the "autoload -Uz compinit && compinit" near the fpath=(...) thing
> or leaving it out.
I would rather leave it out.

If we add this configuration, I would do it in a separate patch that includes text explaining what that line is, and why it might be needed.

-- 
Felipe Contreras
Junio C Hamano· Oct 29, 2020, 17:50 UTC · re: Felipe Contreras · lore

Re: [PATCH] Fix zsh installation instructions

Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 10 quoted lines
> On Tue, Oct 27, 2020 at 2:00 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Лёша Огоньков  <lesha.ogonkov@gmail.com> writes:
>
>> So,... even though it may look to more experienced zsh users that it
>> is unnecessary to document it in this file, in your opinion, it is a
>> good idea to mention "compinit" to help less experienced users?
>
> The first time you run zsh you are greeted with a configuration dialog
> that includes this question:

Ahh, yes, that reminds me why I gave up trying it out the last time. The large dialog asking my permission to contaminate ~/.* was simply too scary and distasteful for a "dip my toe in the water" sightseer.

> If you don't turn on completion, the completion doesn't work for *any* command.
>
> I think most users would understand why git completion doesn't work if
> completion doesn't work for any command.
OK, that sort of makes sense.
> I would rather leave it out.

Makes sense. Instead of adjusting my rerere database for that, ejecting lo/zsh-completion topic would be easier---what the other half of that patch does is already in your 29-patch series.

Thanks.
Junio C Hamano· Oct 29, 2020, 19:09 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix zsh installation instructions

Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
>> I would rather leave it out.
>
> Makes sense.  Instead of adjusting my rerere database for that,
> ejecting lo/zsh-completion topic would be easier---what the other
> half of that patch does is already in your 29-patch series.

Actually, I already have an entry in my rerere database to resolve the merge of these topics to drop the "autoload" suggestion, so I won't have to do anything other than just queuing the v3 of your 29-patch series.

Felipe Contreras· Nov 2, 2020, 20:49 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix zsh installation instructions

On Thu, Oct 29, 2020 at 11:50 AM Junio C Hamano <gitster@pobox.com> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 6 quoted lines
> > The first time you run zsh you are greeted with a configuration dialog
> > that includes this question:
>
> Ahh, yes, that reminds me why I gave up trying it out the last time.
> The large dialog asking my permission to contaminate ~/.* was simply
> too scary and distasteful for a "dip my toe in the water" sightseer.
You don't *need* to run the dialog, just touch a ~/.zshrc file.

This should be enough: --- autoload -U compinit && compinit ---

> Makes sense.  Instead of adjusting my rerere database for that,
> ejecting lo/zsh-completion topic would be easier---what the other
> half of that patch does is already in your 29-patch series.
Yes.
-- 
Felipe Contreras
Felipe Contreras· Nov 2, 2020, 20:54 UTC · re: Felipe Contreras · lore

Re: [PATCH] Fix zsh installation instructions

On Mon, Nov 2, 2020 at 2:49 PM Felipe Contreras <felipe.contreras@gmail.com> wrote:

Show 6 quoted lines
> You don't *need* to run the dialog, just touch a ~/.zshrc file.
>
> This should be enough:
> ---
> autoload -U compinit && compinit
> ---
Or put that in /tmp/zsh, and run zsh with:
    ZDOTDIR=/tmp/zsh zsh -l
No contamination needed.
-- 
Felipe Contreras
Junio C Hamano· Nov 3, 2020, 01:02 UTC · re: Felipe Contreras · lore

Re: [PATCH] Fix zsh installation instructions

Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 5 quoted lines
> Or put that in /tmp/zsh, and run zsh with:
>
>     ZDOTDIR=/tmp/zsh zsh -l
>
> No contamination needed.

Thanks for a few messages with tips, but the point is that it is already much more than what a "dip my toe in the water" sightseer wants to figure out these workarounds.

Junio C Hamano· Nov 2, 2020, 22:37 UTC · re: Felipe Contreras · lore

Re: [PATCH] Fix zsh installation instructions

Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 8 quoted lines
> This should be enough:
> ---
> autoload -U compinit && compinit
> ---
>
>> Makes sense.  Instead of adjusting my rerere database for that,
>> ejecting lo/zsh-completion topic would be easier---what the other
>> half of that patch does is already in your 29-patch series.

Your 29-patch series is now in 'next'; I have this feeing that nobody around here would offer any meaningful reviews on it, so it may graduate sooner than the usual topics.

Thanks.
Felipe Contreras· Oct 28, 2020, 01:31 UTC · re: Лёша Огоньков · lore

Re: [PATCH] Fix zsh installation instructions

On Tue, Oct 27, 2020 at 2:59 AM Лёша Огоньков <lesha.ogonkov@gmail.com> wrote:
>
> As an inexperienced zsh user it took me ages to understand why the
> whole thing is not working.
What was the reason? The filename wasn't correct?
-- 
Felipe Contreras

← back to recent threads