git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/5] teach replace objects to sha1_object_info_extended()

From
Jeff King <peff@peff.net>
Date
Dec 2, 2013, 14:52 UTC
Message-ID
<20131202145225.GA12457@sigill.intra.peff.net>
In-Reply-To
<20131130133934.2697.75781.chriscool@tuxfamily.org>
On Sat, Nov 30, 2013 at 02:51:18PM +0100, Christian Couder wrote:
Show 9 quoted lines
> Here is a patch series to improve the way sha1_object_info_extended()
> behaves when it is passed a replaced object.
> [...]
> Christian Couder (5):
>   replace_object: don't check read_replace_refs twice
>   introduce lookup_replace_object_extended() to pass flags
>   Add an "unsigned flags" parameter to sha1_object_info_extended()
>   t6050: show that git cat-file --batch fails with replace objects
>   sha1_file: perform object replacement in sha1_object_info_extended()
Overall looks OK to me.

I find it a little funny that we reuse the READ_SHA1_FILE_REPLACE flag directly in lookup_replace_object. That means that it is now a meaningful flag for sha1_object_info_extended, even though the name does not say so. It also means that the two may have to coordinate further flags (since a portion of their flag namespace is shared by lookup_replace_object). I don't foresee adding a lot of new flags, though, so it probably isn't a huge deal.

I also would have expected sha1_object_info_extended to simply receive the new flag via the struct object_info. Again, probably not a big deal, because there aren't many callsites that needed updating. But if we were not sharing flags with read_sha1_file, I think doing it as a flag in the struct would be nicer.

I checked the resulting behavior against the list I made earlier; looks like all of the _extended callsites are doing the right thing.

I do think the checks you added in 277336a (replace: forbid replacing an object with one of a different type, 2013-09-06) need updating. I started on that, but I wonder if all of cmd_replace should simply turn off read_replace_refs. I'd think it would always want to be dealing with the true objects.

-Peff
Previous: Christian CouderNext: Jeff King
Message 7 of 11 in “teach replace objects to sha1_object_info_extended()”
  1. 0/5 teach replace objects to sha1_object_info_extended()Christian Couder, Nov 30, 2013
  2. 1/5 replace_object: don't check read_replace_refs twiceChristian Couder, Nov 30, 2013
  3. 2/5 introduce lookup_replace_object_extended() to pass flagsChristian Couder, Nov 30, 2013
  4. 3/5 Add an "unsigned flags" parameter to sha1_object_info_extended()Christian Couder, Nov 30, 2013
  5. 4/5 t6050: show that git cat-file --batch fails with replace objectsChristian Couder, Nov 30, 2013
  6. 5/5 sha1_file: perform object replacement in sha1_object_info_extended()Christian Couder, Nov 30, 2013
  7. Jeff KingDec 2, 2013
  8. Jeff KingDec 2, 2013
  9. Junio C HamanoDec 2, 2013
  10. Christian CouderDec 3, 2013
  11. Christian CouderDec 3, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.