Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 4 commits into from
Mar 9, 2016
Merged

Fixes for gid_odb_expand_ids #3670

merged 4 commits into from
Mar 9, 2016

Conversation

vmg
Copy link
Member

@vmg vmg commented Mar 9, 2016

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.

vmg added 3 commits March 9, 2016 11:00
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.
@vmg
Copy link
Member Author

vmg commented Mar 9, 2016

cc @ethomson @carlosmn

return 0;
} else {
return GIT_ENOTFOUND;
if (error == GIT_PASSTHROUGH) {
Copy link
Member Author

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);
Copy link
Member

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_headers 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.

@vmg vmg force-pushed the vmg/expand-fixes branch from f5b7ce6 to 1bbcb2b Compare March 9, 2016 17:18
ethomson pushed a commit that referenced this pull request Mar 9, 2016
Fixes for `gid_odb_expand_ids`
@ethomson ethomson merged commit 997c67d into master Mar 9, 2016
@ethomson
Copy link
Member

ethomson commented Mar 9, 2016

@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

@vmg
Copy link
Member Author

vmg commented Mar 9, 2016

😂

@ethomson ethomson deleted the vmg/expand-fixes branch January 9, 2019 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants