Re: [PATCH 1/2] get_sha1_with_context: report features used in resolution
From: Jeff King <hidden>
Date: 2016-06-15 22:52:46
On Wed, Jan 11, 2012 at 06:36:12PM -0800, Junio C Hamano wrote:
Jeff King [off-list ref] writes:quoted
Most callers generally treat get_sha1 as a black box, giving it a string from the user and expecting to get a sha1 in return. The get_sha1_with_context function gives callers more information about what happened while resolving the object name so they can make better decisions about how to use the result. We currently use this only to provide information about the path entry used to find a blob. We don't currently provide any information about the resolution rules that were used to reach the final object. Some callers may want these in order to enforce a policy that a particular subset of the lookup rules are used (e.g., when serving remote requests). This patch adds a set of bit-fields that document the use of particular features during an object lookup. Signed-off-by: Jeff King <redacted> --- The diffstat looks a little scary, but it is mostly just the internal get_sha1 functions learning to pass the object_context around.Hmm, shouldn't this also cover peel_to_type()? That would have made it also apply to the maintenance track.
I don't see how peel_to_type is relevant. As far as get_sha1 is concerned, the interesting thing is actually calling peel_onion. It does get the context passed to it in my patch, but I didn't bother marking that the peel feature was used (because it wasn't relevant to the policy I wanted to implement in the follow-on patch). But we could pretty easily mark the use of the peel feature, too. I'm not sure what you mean about the maintenance track, though. AFAICT, we don't separately call peel_to_type, but just potentially use it as part of get_sha1_with_context. Am I missing something? -Peff