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

Re: [PATCH 2/2] completion: stop checking for reference existence via `test -f`

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 1, 2023, 07:49 UTC
Message-ID
<ZWmP-5rgGntYQYMt@tanuki>
In-Reply-To
<20231130202404.89791-3-stanhu@gmail.com>
On Thu, Nov 30, 2023 at 12:24:04PM -0800, Stan Hu wrote:
Show 14 quoted lines
> In contrib/completion/git-completion.bash, there are a bunch of
> instances where we read special refs like HEAD, MERGE_HEAD,
> REVERT_HEAD, and others via the filesystem. However, the upcoming
> reftable refs backend won't use '.git/HEAD' at all but instead will
> write an invalid refname as placeholder for backwards compatibility,
> which will break the git-completion script.
> 
> Update the '__git_ref_exists' function to:
> 
> 1. Recognize the placeholder '.git/HEAD' written by the reftable
>    backend (its content is specified in the reftable specs).
> 2. If reftable is in use, use 'git rev-parse' to determine whether the
>     given ref exists.
> 3. Otherwise, continue to use 'test -f' to check for the ref's filename.

Nit, not worth a reroll: you already document this in the code, but I think it could help to also briefly explain why we're going through all of these hoops here instead of just using git-rev-parse(1) everywhere in the commit message.

Patrick
Previous: Stan HuNext: Junio C Hamano
Message 4 of 15 in “completion: refactor and support reftables backend”
  1. 0/2 completion: refactor and support reftables backendStan Hu, Nov 30, 2023
  2. 1/2 completion: refactor existence checks for special refsStan Hu, Nov 30, 2023
  3. 2/2 completion: stop checking for reference existence via `test -f`Stan Hu, Nov 30, 2023
  4. Patrick SteinhardtDec 1, 2023
  5. Junio C HamanoDec 3, 2023
  6. Patrick SteinhardtDec 1, 2023
  7. 0/2 completion: refactor and support reftables backendStan Hu, Dec 7, 2023
  8. 1/2 completion: refactor existence checks for pseudorefsStan Hu, Dec 7, 2023
  9. Patrick SteinhardtDec 8, 2023
  10. 2/2 completion: support pseudoref existence checks for reftablesStan Hu, Dec 7, 2023
  11. 0/2 completion: refactor and support reftables backendStan Hu, Dec 19, 2023
  12. 1/2 completion: refactor existence checks for pseudorefsStan Hu, Dec 19, 2023
  13. SZEDER GáborJan 13, 2024
  14. 2/2 completion: support pseudoref existence checks for reftablesStan Hu, Dec 19, 2023
  15. Junio C HamanoDec 20, 2023

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.