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

Re: [PATCH 0/2] completion: backwards compatibility fix

From
CMCarsten Mattner <carstenmattner@googlemail.com>
Date
May 20, 2012, 17:27 UTC
Message-ID
<CACY+Hvrj_out4Lm+8Wi3egdc+bs4MWLpVy2X98Uo__r3mSpBOQ@mail.gmail.com>
In-Reply-To
<CAMP44s2sJaW-n7EGTu+hNNkaEnGkk7wKDQD56bgq2=qeeFqWrw@mail.gmail.com>

On Sun, May 20, 2012 at 12:28 PM, Felipe Contreras <felipe.contreras@gmail.com> wrote:

Show 40 quoted lines
> On Sun, May 20, 2012 at 11:02 AM, Carsten Mattner
> <carstenmattner@googlemail.com> wrote:
>> On Sat, May 19, 2012 at 4:41 AM, Felipe Contreras
>> <felipe.contreras@gmail.com> wrote:
>>> Hi,
>>>
>>> These two patches are meant to fix the backwards compatibility of _git, and
>>> _gitk. This also helps my zsh's wrapper.
>>>
>>> Felipe Contreras (2):
>>>  completion: rename _git and _gitk
>>>  completion: add support for backwards compatibilit
>>>
>>>  contrib/completion/git-completion.bash |   22 +++++++++++++++++-----
>>>  t/t9902-completion.sh                  |    2 +-
>>>  2 files changed, 18 insertions(+), 6 deletions(-)
>>>
>>> --
>>> 1.7.10.2
>>>
>>
>> Thanks Felipe. With the 2 patches applied all the following
>> completion definitions work.
>>
>> complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \
>>   || complete -o default -o nospace -F _git g
>> __git_complete g _git
>> __git_complete g _main_git
>>
>> Ignoring backwards compatibility, which one would you suggest
>> I use? Keep in mind that I originally copied the first
>> long completion defintion from git-completion.bash a long time
>> ago.
>
> I would use '__git_complete g _git', but keep in mind that none of
> these forms have a promise to stay. Eventually the final one would be
> '_GIT_complete g _git' (hopefully), but if you want to be safe from
> changes maybe the first (original) would be best; even though there's
> no promise it won't break, we would probably try our best not to break
> it (again).

What about adding a small note at the top of the completion script together with the other documentation? Does it make sense to keep the known to work and public invocation in there?

Show 6 quoted lines
> BTW. If your system has the '-o bashdefault' option you probably don't
> need the full form, just:
> % complete -o bashdefault -o default -o nospace -F _git g
>
> Or if your system doesn't:
> % complete -o default -o nospace -F _git g
I like the short versions. They seem to work.
Previous: Felipe Contreras
Message 14 of 14 in “completion: backwards compatibility fix”
  1. 0/2 completion: backwards compatibility fixFelipe Contreras, May 19, 2012
  2. 1/2 completion: rename _git and _gitkFelipe Contreras, May 19, 2012
  3. SZEDER GáborMay 22, 2012
  4. Junio C HamanoMay 22, 2012
  5. Felipe ContrerasMay 22, 2012
  6. 2/2 completion: add support for backwards compatibilityFelipe Contreras, May 19, 2012
  7. Jeff KingMay 19, 2012
  8. Carsten MattnerMay 19, 2012
  9. Jeff KingMay 19, 2012
  10. Carsten MattnerMay 19, 2012
  11. Junio C HamanoMay 20, 2012
  12. Carsten MattnerMay 20, 2012
  13. Felipe ContrerasMay 20, 2012
  14. Carsten MattnerMay 20, 2012

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.