Re: [PATCH] replace: stop replace lookup when reaching a self-reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 29, 2019 at 08:22:49PM +0900, Mike Hommey wrote:

> It is possible to end up in situations where a replace ref points to
> itself. In that case, it would seem better to stop the lookup rather
> than try to follow the link infinitely and fail with "replace depth too
> high".

I don't think this is worth doing. It's just a special case (a 2-node
cycle in the replace graph) of a more general one (an n-node cycle).

We catch the general case with the depth counter (though of course there
are other techniques, which we could debate). Is it worth adding extra
code to cover this special one?

> I'm not entirely sure whether it's actually worth fixing. Arguably, `git
> replace` should also avoid the footgun in the first place (although in
> my case, it wasn't due to `git replace` itself).

Yes, if "git replace $OID $OID" does not complain, it probably should.

Perhaps it should even confirm that the replacement can be resolved, and
does not point to the original object. That covers the n-node case, as
well.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux