git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Stan Hu <stanhu@gmail.com>
Cc: git@vger.kernel.org, Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH 2/2] completion: stop checking for reference existence via `test -f`
Date: Fri, 1 Dec 2023 08:49:15 +0100	[thread overview]
Message-ID: <ZWmP-5rgGntYQYMt@tanuki> (raw)
In-Reply-To: <20231130202404.89791-3-stanhu@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

On Thu, Nov 30, 2023 at 12:24:04PM -0800, Stan Hu wrote:
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-12-01  7:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 20:24 [PATCH 0/2] completion: refactor and support reftables backend Stan Hu
2023-11-30 20:24 ` [PATCH 1/2] completion: refactor existence checks for special refs Stan Hu
2023-11-30 20:24   ` [PATCH 2/2] completion: stop checking for reference existence via `test -f` Stan Hu
2023-12-01  7:49     ` Patrick Steinhardt [this message]
2023-12-03 13:15   ` [PATCH 1/2] completion: refactor existence checks for special refs Junio C Hamano
2023-12-01  7:49 ` [PATCH 0/2] completion: refactor and support reftables backend Patrick Steinhardt
2023-12-07  6:06 ` [PATCH v2 " Stan Hu
2023-12-07  6:06   ` [PATCH v2 1/2] completion: refactor existence checks for pseudorefs Stan Hu
2023-12-08  8:24     ` Patrick Steinhardt
2023-12-07  6:06   ` [PATCH v2 2/2] completion: support pseudoref existence checks for reftables Stan Hu
2023-12-19 22:14 ` [PATCH v3 0/2] completion: refactor and support reftables backend Stan Hu
2023-12-19 22:14   ` [PATCH v3 1/2] completion: refactor existence checks for pseudorefs Stan Hu
2024-01-13 21:07     ` SZEDER Gábor
2023-12-19 22:14   ` [PATCH v3 2/2] completion: support pseudoref existence checks for reftables Stan Hu
2023-12-20  0:48   ` [PATCH v3 0/2] completion: refactor and support reftables backend Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWmP-5rgGntYQYMt@tanuki \
    --to=ps@pks.im \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=stanhu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).