Re: [PATCH 4/4] core.abbrev: raise the default abbreviation to 12 hexdigits
From: Junio C Hamano <hidden>
Date: 2016-09-30 20:01:23
Linus Torvalds [off-list ref] writes:
On Fri, Sep 30, 2016 at 10:54 AM, Linus Torvalds [off-list ref] wrote:quoted
quoted
So IMHO, the best combination is the init_default_abbrev() you posted in [1], but initialized at the top of find_unique_abbrev(). And cached there, obviously, in a similar way.That's certainly possible, but I'm really not happy with how the counting function looks. And nobody actually stood up to say "yeah, that gets alternate loose objects right" or "if you have tons of those alternate loose objects you have other issues anyway". I think somebody would have to "own" that counting function, the advantage of just putting it into disambiguate_state is that we just get the counting for free..Side note: maybe we can mix the two approaches, and keep the counting in the disambiguation state, and just make the counting function do init_object_disambiguation(); find_short_object_filename(&ds); find_short_packed_object(&ds); finish_object_disambiguation(&ds, sha1); and then just use "ds.nrobjects". So the counting would still be done by the disambiguation code, it just woudln't be in get_short_sha1(). So here's another version that takes that approach. And if somebody (hint hint) wants to do the counting differently, they can perhaps send an incremental patch to do that. (This patch also contains the few setup issues Junio found with the new "default_abbrev is negative" model)
Sorry, but I do not quite see the point in the difference between this one and your original that had a hook in get_short_sha1(), as it seemed to me that Peff's objection was about the counting done in find_short_object_filename() and find_short_packed_object(), which is (understandably) still here.