On Thu, Oct 24, 2019 at 04:25:46PM -0700, Jonathan Tan wrote: > Firstly, this patch is not about remembering, but about not setting > anything, so I think that the title should be something like: > > commit, tag: set parsed only if no parsing error True. I had also played with actually remembering via a bit, which I think is how I ended up thinking about it that way. You could argue that it is "not forgetting", which is remembering. :) But I think your suggested title is better. > Incidentally, the check that you mentioned in PATCH 02 is probably no > longer necessary. The tests all pass even with the following diff: > > diff --git a/commit.c b/commit.c > index e12e7998ad..086011d944 100644 > --- a/commit.c > +++ b/commit.c > @@ -359,7 +359,7 @@ struct tree *repo_get_commit_tree(struct repository *r, > struct object_id *get_commit_tree_oid(const struct commit *commit) > { > struct tree *tree = get_commit_tree(commit); > - return tree ? &tree->object.oid : NULL; > + return &tree->object.oid; > } Ah, I see the confusion you had earlier. The check I meant in patch 2 (and here) was the one in write_graph_chunk_data(), which checks for a non-NULL tree even after we just saw a successful parse. I agree that getting rid of the check in get_commit_tree_oid() is unlikely to cause any bugs, but there are still cases where it could help. Namely if I choose to ignore the parse failure (because I want to see the parts of the commit struct that we did manage to get), then I'd like to be able to ask whether we have a valid tree, like: oid = get_commit_tree_oid(commit); if (!oid) do something... With the revert you showed above, that's dangerous, because we'd get a bogus value like "8" (because the oid is offset 8 bytes in the struct which we've dereferenced as NULL). You could obviously use "get_commit_tree()" instead, which would let you compare to NULL. But it seemed simpler to leave the extra safety in place. -Peff