git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] completion: reduce overhead of clearing cached --options

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jun 8, 2018, 21:41 UTC
Message-ID
<CAM0VKjkWkUmU9LGyKKFyvkOCFh1s+JJK4aZLPfoOJj26OkNQVg@mail.gmail.com>
In-Reply-To
<20180608212348.GA42503@aiede.svl.corp.google.com>
On Fri, Jun 8, 2018 at 11:23 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 25 quoted lines
> Hi,
>
> SZEDER Gábor wrote:
>
>> Being in RC phase, I'm all for aiming for a minimal solution.
>> However, I don't think that the better fix would be erm.. any "less
>> minimal":
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index f2aa484758..7aeb575cd1 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -3244,7 +3244,10 @@ __gitk_main ()
>>       __git_complete_revlist
>>  }
>>
>> -if [[ -n ${ZSH_VERSION-} ]]; then
>> +if [[ -n ${ZSH_VERSION-} ]] &&
>> +   # Don't define these functions when sourced from 'git-completion.zsh',
>> +   # it has its own implementations.
>> +   [[ -z "${GIT_SOURCING_ZSH_COMPLETION}" ]] ; then
>
> Needs a - before the } to avoid errors in a shell where the user has
> chosen to use "set -u".  See v1.7.4-rc0~159 (completion: fix zsh check
> under bash with 'set -u', 2010-10-27) for more details.

Right... I did remember that, but by the time I finished typing out that long variable name I forgot about it... :)

However, I'm not sure it's worth caring about, because the bash-competion scripts don't work with 'set -u' anyway...

Show 22 quoted lines
>>       echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
>>
>>       autoload -U +X compinit && compinit
>> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
>> index 53cb0f934f..049d6b80f6 100644
>> --- a/contrib/completion/git-completion.zsh
>> +++ b/contrib/completion/git-completion.zsh
>> @@ -39,7 +39,7 @@ if [ -z "$script" ]; then
>>               test -f $e && script="$e" && break
>>       done
>>  fi
>> -ZSH_VERSION='' . "$script"
>> +GIT_SOURCING_ZSH_COMPLETION=y . "$script"
>>
>>  __gitcomp ()
>>  {
>
> Except for that tweak,
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
> Thanks.
>
> Now it just needs a commit message. :)
Previous: Jonathan NiederNext: Jonathan Nieder
Message 30 of 38 in “specify encoding for sed command”
  1. specify encoding for sed commandStephon Harris, Apr 5, 2018
  2. Ævar Arnfjörð BjarmasonApr 5, 2018
  3. Eric SunshineApr 5, 2018
  4. SZEDER GáborApr 5, 2018
  5. Matt ColemanApr 10, 2018
  6. Matt ColemanApr 11, 2018
  7. Matthew ColemanApr 12, 2018
  8. SZEDER GáborApr 13, 2018
  9. Matthew ColemanApr 13, 2018
  10. completion: reduce overhead of clearing cached --optionsSZEDER Gábor, Apr 13, 2018
  11. Jakub NarebskiApr 13, 2018
  12. SZEDER GáborApr 13, 2018
  13. Jakub NarebskiApr 14, 2018
  14. Jacob KellerApr 16, 2018
  15. Matthew ColemanApr 16, 2018
  16. Junio C HamanoApr 16, 2018
  17. SZEDER GáborApr 16, 2018
  18. Jakub NarębskiApr 16, 2018
  19. Junio C HamanoApr 16, 2018
  20. completion: reduce overhead of clearing cached --optionsSZEDER Gábor, Apr 17, 2018
  21. Junio C HamanoApr 17, 2018
  22. Matthew ColemanMay 7, 2018
  23. Todd ZullingerMay 8, 2018
  24. Junio C HamanoMay 8, 2018
  25. Jonathan NiederJun 7, 2018
  26. Dave BorowitzJun 7, 2018
  27. Rick van HattemJun 7, 2018
  28. SZEDER GáborJun 8, 2018
  29. Jonathan NiederJun 8, 2018
  30. SZEDER GáborJun 8, 2018
  31. Jonathan NiederJun 8, 2018
  32. SZEDER GáborJun 8, 2018
  33. Junio C HamanoJun 11, 2018
  34. completion: correct zsh detection when run from git-completion.zsh (Re: [PATCH v2] completion: reduce overhead of clearing cached --options)Jonathan Nieder, Jun 11, 2018
  35. SZEDER GáborJun 12, 2018
  36. SZEDER GáborJun 12, 2018
  37. Rick van HattemJun 12, 2018
  38. Junio C HamanoApr 8, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.