Subject: Re: [PATCH 8/8] cache-tree: avoid path comparison loop when silent

From: Junio C Hamano <[email-masked]>
Date: Wed, 06 Jan 2021 00:55:22 -0800

Elijah Newren <[email-masked]> writes:

> Looking through that code, I come to the same conclusion, though it
> might be nice to have Junio confirm (and to explain the "if (10 <
> ++funny)" section; did that help debugging too?).   The second part of
> the loop was part of his initial commit adding the cache-tree
> extension in commit 749864627c ("Add cache-tree.", 2006-04-23)

This is not about debugging our implementation.  The verification
was done to protect against the on-disk index file left by broken
implementations of other people.  Either JGit or Dulwich (I do not
recall which one) used to have such a broken sort long time ago,
IIRC, and the thing is, a broken implementation can be internally
consistent.

I do not think we've heard problem reports discovered by this check
about other peoples' broken implementation, but a chicken-and-egg is
certainly in action here.  The check would have caught any new and
broken implementation of Git before it got released to the wild to
cause harm and that is probably we haven't heard.