-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fixes for gid_odb_expand_ids
#3670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The old implementation had two issues: 1. OIDs that were too short as to be ambiguous were not being handled properly. 2. If the last OID to expand in the array was missing from the ODB, we would leak a `GIT_ENOTFOUND` error code from the function.
return 0; | ||
} else { | ||
return GIT_ENOTFOUND; | ||
if (error == GIT_PASSTHROUGH) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we can know distinguish between the backends being unable to read headers, and the backends not finding the header at all.
Also, I've actually implemented ODB refreshing for git_odb_read_header
. Before that, we wouldn't refresh the ODB on ENOTFOUND
under no circumstances, we would just fall back to git_odb_read
, which does refresh.
continue; | ||
|
||
if (b->read_header != NULL) | ||
error = b->read_header(len_p, type_p, b, id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will now stop this loop immediately and return E_PASSTHROUGH
if any of the read_header
s returned E_PASSTHROUGH
. I feel like the correct thing to do here would be to remember that one of the backends returned E_PASSTHROUGH
, but continue. One of the other backends may be the one that actually has this object.
This lets that later-ordered backend service the read_header
request, on the assumption that read_header
is cheaper than the full read
.
Fixes for `gid_odb_expand_ids`
@vmg - fixing my bugs since 2003. Okay, maybe not that long ago, but a more accurate year doesn't rhyme and in any case, it's been a long ass time |
😂 |
Fixes the issue with leaking the error code for the last OID in the array, and the ODB refreshes that were (still) being performed on missing objects.