Thread (23 messages) 23 messages, 5 authors, 2025-08-20

Re: [PATCH 5/5] describe: pass commit to describe_commit()

From: Patrick Steinhardt <hidden>
Date: 2025-08-19 08:05:31

On Mon, Aug 18, 2025 at 05:04:17PM -0400, Jeff King wrote:
There's a call in describe_commit() to lookup_commit_reference(), but we
don't check the return value. If it returns NULL, we'll segfault as we
immediately dereference the result.

In practice this can never happen, since all callers pass an oid which
came from a "struct commit" already. So we can make this more obvious
by just taking that commit struct in the first place.
I was wondering a bit about commit-graphs. We had the case in the past
where it was possible to look up commits via the graph even though they
don't exist in the ODB. So we might actually end up with a missing
object if `GIT_COMMIT_GRAPH_PARANOIA=false`, which is the default value.
But that might be fine? No idea without digging further.

In any case, the refactoring makes sense regardless from my point of
view.

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help