From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Scott Chacon <schacon@gmail.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>
Subject: a "limbo" object-format state for empty repositories?
Date: Fri, 2 Oct 2026 18:44:00 -0400 [thread overview]
Message-ID: <20261002224400.GA834158@coredump.intra.peff.net> (raw)
Reading Scott's blog post and accompanying HN comments the other day,
one upcoming usability headache stood out to me: first-time pushes to
newly created repositories.
If you create a bare repo on a forge like GitHub, it must be either sha1
or sha256. If the forge continues to create sha1 bare repos by default,
then all of the post-3.0 sha256 users will get this on first push:
$ git push
fatal: the receiving end does not support this repository's hash algorithm
fatal: the remote end hung up unexpectedly
And then they have to go switch or recreate their remote repo. And if
the forge flips to sha256, then we have the opposite problem for pre-3.0
users (and even 3.0 users who are doing a first-push of existing sha1
repositories).
Savvy users will of course specify the object format they expect to use
when they create the server-side repo. But most users won't know or care
about this, and even if they do, it's an easy thing to forget about. So
I expect we'll see a lot of frustration here.
It would be nice if the empty repository could adapt to the object
format used by its first push. Then everything would just work from the
user's perspective, no matter what they push.
GitHub has long done something similar for the HEAD pointer; on first
push of a single branch it is pointed at that branch. There it was not
too hard to add custom code around Git that detected the situation and
set up the symref. But I don't think you can quite do the same thing for
the object format, because the push advertisement actually says "hey,
I'm a <hash> repo" in its capabilities. So the client says "oh, that
doesn't match me" and bails before actually pushing anything.
So what I'm suggesting instead is that the server be allowed to
advertise a limbo state: it has no object format yet. And then client
can recognize object-format=limbo, and send back "I'm a <sha1|sha256>
repo, so that's what I'm sending you" in its capabilities response. And
then the server receives that and shifts its local object-format to
match.
There are some tricky bits on the server side (e.g., you'd want to flip
the value atomically so that if you get two simultaneous mismatched
pushes, one of them gets rejected). But I can't think of any reason that
it couldn't conceptually work, and I feel like it would save a lot of
headaches.
But I also did just think of this idea, and haven't implemented anything
(nor do I have immediate plans to). So it might be half-baked. But I
thought I'd toss it out there and see if any body has thoughts, or feels
strongly enough to try implementing it.
-Peff
next reply other threads:[~2026-10-02 22:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 22:44 Jeff King [this message]
2026-10-03 1:07 ` a "limbo" object-format state for empty repositories? brian m. carlson
2026-10-03 1:25 ` Jeff King
2026-10-03 14:22 ` brian m. carlson
2026-10-05 3:30 ` Jeff King
2026-10-03 1:31 ` 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=20261002224400.GA834158@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
--cc=schacon@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