On Thu, Dec 08, 2022 at 12:50:27AM +0100, Ævar Arnfjörð Bjarmason wrote: > I have a mild preference for my latest suggestion as the ownership of > all the variables seems cleanest in that iteration. I.e. we don't need > to xstrdup(), and the "fd" is always contained within > map_loose_object_1(). > > We still have the "sometimes a path, sometimes I make a path from an > oid" semantics though, but that seems unavoidable. Of the two warts, I think "this function consume the fd" is less weird than the two path variables (one sometimes-in and one sometimes-out). If the fd thing is too ugly, we could have the function _not_ consume the fd, but I think that probably makes the callers worse. At any rate, we can wait and see what Jonathan comes up with. (As an aside, thank you Jonathan for dealing with some of this long-standing ugliness; it is not directly related to your goal, but I think it's adjacent enough to merit doing it as part of the series). -Peff