All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: <git@vger.kernel.org>
Subject: Re: [RFC PATCH 6/6] hex: allow only lowercase object IDs in breaking changes mode
Date: Fri, 31 Jul 2026 05:33:47 -0700	[thread overview]
Message-ID: <xmqqtspffidw.fsf@gitster.g> (raw)
In-Reply-To: <xmqqv79vha69.fsf@gitster.g> (Junio C. Hamano's message of "Fri, 31 Jul 2026 00:48:14 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
>> Git has historically allowed either lowercase or uppercase hex for
>> object IDs, but it has always emitted only lowercase.  This has caused
>> people to expect only lowercase and not handle uppercase.
>
> It is violation of Postel's Law by other people.  We do not
> necessarily have to follow suit.

Imagine we somehow misbehave badly when we have two loose object
files storing the same object's contents.  Let us further imagine
that we can download these individual loose object files from
others, perhaps via the dumb HTTP transport.

If we tried to be robust, we would be liberal in what we accept,
even though we try to be strict in what we produce.  In this
hypothetical scenario, if we talk to someone else over the dumb
HTTP transport and find that they have an objects/AB/ directory, we
may try to be liberal and say, "Ah, that is a fan-out directory
housing all their loose objects whose names begin with 'ab'."

This is the right thing to do for those who liberally accept
others' data.

But we might further say, "Let us enumerate and download what we do
not have locally.  They have a file 012345...EF (38 hex characters)
in that directory, which stores the object AB012345...EF (40 hex
characters) in loose object form," and then conclude, "and we do not
have it," even when we actually have the file ab/012345...ef in
all-lowercase form locally!

However, liberally accepting AB/012345...EF and storing it verbatim
in our own store will break things because, in this hypothetical
scenario, we will misbehave when we have both ab/012345...ef (which
we had from the start) and AB/012345...EF (which we just downloaded)
at the same time.

The approach taken by this RFC series is to stop recognizing their
objects/AB/ as a valid fan-out directory and their AB/012345...EF as
a valid loose object file.  While I agree that this is certainly
one way to avoid entering such a state and triggering bad behavior,
I think the real solution that honors the robustness principle is to
still recognize objects/AB/012345...EF as valid, recognize it as a
loose object file for ab012345...ef, and notice that it represents
the same object ab012345...ef we already have.  Then we can avoid
misbehaving without being less liberal than we used to be.

If the system had been case-sensitive from day one, and ignoring
uppercase hex had been the norm from the beginning, I would not have
found it so disturbing that we reject case-insensitive object names
and being stricter than folks with those other systems may feel is
necessary.

Tightening the rule after twenty years is the part I am most
hesitant to accept.  So, I dunno.

  reply	other threads:[~2026-07-31 12:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 23:32 [RFC PATCH 0/6] Git 3.0: restrict hex object IDs to lowercase only brian m. carlson
2026-07-29 23:32 ` [RFC PATCH 1/6] hex: add functionality for lowercase-only hex brian m. carlson
2026-07-31  7:38   ` Junio C Hamano
2026-07-29 23:32 ` [RFC PATCH 2/6] hex: allow specifying hex type with hex2chr brian m. carlson
2026-07-29 23:32 ` [RFC PATCH 3/6] hex: make hex_to_bytes accept kind of hex to use brian m. carlson
2026-07-31  7:38   ` Junio C Hamano
2026-07-29 23:32 ` [RFC PATCH 4/6] hex: label usages of hex parsing for object IDs brian m. carlson
2026-07-31  3:24   ` Junio C Hamano
2026-07-29 23:32 ` [RFC PATCH 5/6] object-name: use hexval brian m. carlson
2026-07-29 23:32 ` [RFC PATCH 6/6] hex: allow only lowercase object IDs in breaking changes mode brian m. carlson
2026-07-31  7:48   ` Junio C Hamano
2026-07-31 12:33     ` Junio C Hamano [this message]
2026-07-30  8:21 ` [RFC PATCH 0/6] Git 3.0: restrict hex object IDs to lowercase only Junio C Hamano
2026-07-30 21:18   ` brian m. carlson

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=xmqqtspffidw.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.