Subject: Re: [PATCH] fast-import: avoid making replace refs point to themselves

From: Junio C Hamano <[email-masked]>
Date: Fri, 15 Nov 2024 12:51:46 +0900

Elijah Newren <[email-masked]> writes:

> ...  If the repository
> had a value for the replace ref before fast-import was run, and the
> replace ref was explicitly named in the fast-import stream, I don't
> want the replace ref to be left with a pre-fast-import value.

Ah, right.  We want to honor the user's latest wish, i.e., if they
create a replace ref that maps A to A, when they ask for object A,
instead of returning it, we need to return what the replace ref
refers to, which happens to be object A.  So you are right. "You are
trying to map A to A, so we'll ignore that request" is a wrong thing
to do.  "In order to give you A when you ask for A, we will remove
the existing mapping for A" is absolutely the right thing to do,
which is what your patch does.

Thanks.