git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: Adam Majer <adamm@zombino.com>, git@vger.kernel.org
Subject: Re: [PATCH] setup: recognize bare repositories with packed-refs
Date: Thu, 7 Dec 2023 09:37:25 +0100	[thread overview]
Message-ID: <ZXGERbcSiM8PDQbw@tanuki> (raw)
In-Reply-To: <20231207073451.GA1278091@coredump.intra.peff.net>

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

On Thu, Dec 07, 2023 at 02:34:51AM -0500, Jeff King wrote:
> On Thu, Dec 07, 2023 at 08:01:41AM +0100, Patrick Steinhardt wrote:
> 
> > > So forgetting at all about how we structure the code, it seems to me
> > > that the problem is not new code, but all of the existing code which
> > > looks for access("refs", X_OK).
> > 
> > True. The question is of course how much value there is in an old tool
> > to be able to discover a new repository that it wouldn't be able to read
> > in the first place due to it not understanding the reference format. So
> > I'd very much like to see that eventually, we're able to get rid of
> > "legacy" cruft that doesn't serve any purpose anymore.
> 
> Right, nobody is going to be mad about not being able to use the
> repository with old code. My concern is that by skipping it in the
> discovery phase, though, the user may see unexpected behavior (like
> continuing and finding some _other_ repo). I admit it's a pretty narrow
> case, though.

Agreed, that's also an angle I brought up in a separate thread [1]. The
second benefit is that the user would get a proper error message stating
that the "extensions.refFormat" is not understood compared to Git just
skipping over the repository completely.

> > The question is whether we can do a better job of this going forward so
> > that at least we don't have to pose the same question in the future.
> > Right now, we'll face the same problem whenever any part of the current
> > on-disk repository data structures changes.
> > 
> > I wonder whether it would make sense to introduce something like a
> > filesystem-level hint, e.g. in the form of a new ".is-git-repository"
> > file. If Git discovers that file then it assumes the directory to be a
> > Git repository -- and everything else is set up by parsing the config
> > and thus the repository's configured format.
> 
> I kind of think the presence of a well-formed HEAD is a good indicator
> that it is a Git directory. IOW, I don't have any real problem with
> simply loosening is_git_directory() to remove the "refs/" check
> entirely. But again, that can only help us going forward; older versions
> will still get confused if we truly ditch "refs/" for other formats.
> 
> Of course some ref formats may want to avoid the "HEAD" file itself, so
> your .is-git-repository would be cleaner. I'm just not sure if it's
> worth the headache to try to switch things now.

I think that both "HEAD" and "refs/" are in the same spirit and consider
both to be legacy cruft that ideally wouldn't exist with the reftable
backend. I think dropping just one of these requirements ("refs/") is
the least favorable option though:

  - We'd still have unneeded files that only exist to aid old clients.

  - At the same time, the old clients wouldn't be able to detect the
    repository anymore and need an update. So we could just as well drop
    both files and would have the same outcome.

  - This is not a long-term solution in case anything else in the
    on-disk format will ever change.

Whether it's worth getting rid of them now... probably not, at least not
for the time being. But if we want to address this issue I'd rather want
to aim for a proper solution that also works for future changes.

Patrick

[1]: <ZXFy0_T1AZLh058g@tanuki>

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

  reply	other threads:[~2023-12-07  8:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 20:25 [PATCH] setup: recognize bare repositories with packed-refs Adam Majer
2023-11-17 20:32 ` Adam Majer
2023-11-17 20:44   ` Adam Majer
2023-11-19 23:24   ` Junio C Hamano
2023-11-20  9:31     ` Glen Choo
2023-11-27 19:42       ` Josh Steadmon
2023-11-20  9:43     ` Adam Majer
2023-11-27 19:44   ` Josh Steadmon
2023-11-28 14:14     ` Adam Majer
2023-11-28 14:28   ` Adam Majer
2023-11-28 18:45     ` Josh Steadmon
2023-11-28 19:04     ` Jeff King
2023-11-29 10:13       ` Patrick Steinhardt
2023-12-06 20:10         ` Jeff King
2023-12-07  7:01           ` Patrick Steinhardt
2023-12-07  7:34             ` Jeff King
2023-12-07  8:37               ` Patrick Steinhardt [this message]
2023-11-29 21:30       ` Taylor Blau
2023-12-06 21:08         ` Jeff King
2023-12-07  8:20           ` Adam Majer
2023-12-08 21:09           ` Taylor Blau
2023-12-12  1:22             ` Jeff King
2023-12-08 18:17       ` 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=ZXGERbcSiM8PDQbw@tanuki \
    --to=ps@pks.im \
    --cc=adamm@zombino.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).