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

Re: [PATCHv2 07/14] completion: don't disambiguate short refs

From
Jeff King <peff@peff.net>
Date
Mar 24, 2017, 19:31 UTC
Message-ID
<20170324193149.pa4lrsodgmgsvidl@sigill.intra.peff.net>
In-Reply-To
<20170323152924.23944-8-szeder.dev@gmail.com>
On Thu, Mar 23, 2017 at 04:29:17PM +0100, SZEDER Gábor wrote:
> However, it's questionable whether ambiguous refs are really that bad
> to justify that much extra cost:

It's not clear to me that the existing completion actually does a good job with disambiguation anyway.

If I have a tag and a branch named "foo", then in theory doing:
  git log fo<Tab>

should present me with "heads/foo" and "tags/foo" as options. But it doesn't seem to; it just completes "foo".

But even if it did, those don't _start_ with foo, I have to go to some work to back up anyway. I think we are better off just completing "foo" and letting the command complain that it's ambiguous.

So even leaving aside the performance tradeoff, that seems like a more sensible behavior anyway. And AFAICT, that's the behavior you'd get with your patch (we'd get two "foo"s, but the completion is presumably smart enough to handle that.

Show 17 quoted lines
> This speeds up refs completion considerably.  Uniquely completing a
> branch in a repository with 100k local branches, all packed, best of
> five:
> 
>   On Linux, before:
> 
>     $ time __git_complete_refs --cur=maste
> 
>     real    0m1.662s
>     user    0m1.368s
>     sys     0m0.296s
> 
>   After:
> 
>     real    0m0.831s
>     user    0m0.808s
>     sys     0m0.028s

This is nice, though I think faster ref storage is another way to attack the problem. This is much simpler, though. :)

-Peff
Previous: SZEDER GáborNext: SZEDER Gábor
Message 6 of 22 in “[PATCHv2 00/14] completion: speed up refs completion”
  1. SZEDER GáborMar 23, 2017
  2. 01/14 completion: remove redundant __gitcomp_nl() options from _git_commit()SZEDER Gábor, Mar 23, 2017
  3. 05/14 completion: support excluding full refsSZEDER Gábor, Mar 23, 2017
  4. 04/14 completion: support completing fully qualified non-fast-forward refspecsSZEDER Gábor, Mar 23, 2017
  5. 07/14 completion: don't disambiguate short refsSZEDER Gábor, Mar 23, 2017
  6. Jeff KingMar 24, 2017
  7. 13/14 completion: fill COMPREPLY directly when completing fetch refspecsSZEDER Gábor, Mar 23, 2017
  8. 08/14 completion: let 'for-each-ref' and 'ls-remote' filter matching refsSZEDER Gábor, Mar 23, 2017
  9. Jeff KingMar 24, 2017
  10. SZEDER GáborMar 28, 2017
  11. 09/14 completion: let 'for-each-ref' strip the remote name from remote branchesSZEDER Gábor, Mar 23, 2017
  12. 10/14 completion: let 'for-each-ref' filter remote branches for 'checkout' DWIMerySZEDER Gábor, Mar 23, 2017
  13. 14/14 completion: speed up branch and tag completionSZEDER Gábor, Mar 23, 2017
  14. 12/14 completion: fill COMPREPLY directly when completing refsSZEDER Gábor, Mar 23, 2017
  15. 11/14 completion: let 'for-each-ref' sort remote branches for 'checkout' DWIMerySZEDER Gábor, Mar 23, 2017
  16. Jeff KingMar 24, 2017
  17. 03/14 completion: support completing full refs after '--option=refs/<TAB>'SZEDER Gábor, Mar 23, 2017
  18. 02/14 completion: wrap __git_refs() for better option parsingSZEDER Gábor, Mar 23, 2017
  19. 06/14 completion: don't disambiguate tags and branchesSZEDER Gábor, Mar 23, 2017
  20. SZEDER GáborMar 23, 2017
  21. Junio C HamanoMar 23, 2017
  22. Jeff KingMar 24, 2017

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.