On Sat, Jan 11, 2020 at 02:34:55PM -0800, Jonathan Tan wrote: > In particular, document the behavior when the object is corrupt. The > existing behavior when parse_object() encounters a hash mismatch has > been there since cc243c3ceb ("show: --ignore-missing", 2011-05-19), and > the existing behavior when the code disagrees on whether an object is a > commit has been there since ec0c5798ee ("revision: use commit graph in > get_reference()", 2018-12-28). Does "disagreement on whether an object is a commit" count as corrupt object? Otherwise I'm not seeing mention of it in the comment that was added. > --- > revision.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/revision.c b/revision.c > index 8136929e23..91ca194388 100644 > --- a/revision.c > +++ b/revision.c > @@ -355,6 +355,16 @@ void add_head_to_pending(struct rev_info *revs) > add_pending_object(revs, obj, "HEAD"); > } > > +/* > + * Returns the object corresponding to "oid" and sets the given flags on > + * it. > + * > + * If that object is missing or corrupt, this function returns NULL if > + * "revs" permits it (that is, if revs->ignore_missing is true or if > + * revs->exclude_promisor_objects is true and the object is a promisor > + * object), and dies otherwise. Note that corrupt objects are treated The parenthetical is hard to parse. Is it "(revs->ignore_missing is true) or (revs->exclude_promisor_objects is true and the object is a promisor)" or something else? Maybe an extra comma, (that is, if revs->ignore_missing is true, or if revs->exclude_promisor_objects is true and the object is a promisor object) > + * like missing objects, to preserve existing behavior. > + */ > static struct object *get_reference(struct rev_info *revs, const char *name, > const struct object_id *oid, > unsigned int flags) > -- > 2.25.0.rc1.283.g88dfdc4193-goog >