Skip to content
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

oid: do not load the object when expanding #397

Merged
merged 1 commit into from
Jul 28, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/oid.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ py_oid_to_git_oid_expand(git_repository *repo, PyObject *py_str, git_oid *oid)
int err;
size_t len;
git_odb *odb = NULL;
git_odb_object *obj = NULL;
git_oid tmp;

len = py_oid_to_git_oid(py_str, oid);
if (len == 0)
Expand All @@ -130,17 +130,16 @@ py_oid_to_git_oid_expand(git_repository *repo, PyObject *py_str, git_oid *oid)
if (err < 0)
goto error;

err = git_odb_read_prefix(&obj, odb, oid, len);
err = git_odb_exists_prefix(&tmp, odb, oid, len);
if (err < 0)
goto error;

git_oid_cpy(oid, git_odb_object_id(obj));
git_odb_object_free(obj);
git_oid_cpy(oid, &tmp);

git_odb_free(odb);
return 0;

error:
git_odb_object_free(obj);
git_odb_free(odb);
Error_set(err);
return -1;
Expand Down