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

From: Junio C Hamano <[email-masked]>
Date: Fri, 15 Nov 2024 10:08:04 +0900

Junio C Hamano <[email-masked]> writes:

> I am not sure if a warning is even warranted.  If you decide to
> replace an object A with the same object A, the result ought to be a
> no-op.  I wonder if it is makes more sense to
>
>  (1) do this unconditionally and silently, and
>  (2) when we prepare the replace_map, ignore self-referencing ones.
>
> instead.  If (2) makes sense entirely depends on the answer of an
> earlier question (i.e. "is there a reason why self-reference is more
> common than general loop?").

Forgot to add.  (1) could be done even at a lower layer, i.e. the
ref API could be told to reject such a replace ref creation/update
that maps an object name to itself.