Commit a147408f by nulltoken

reset: make reset rely on git_repository_head()

parent b52b6571
......@@ -29,6 +29,7 @@ int git_reset(
git_tree *tree = NULL;
int error = -1;
git_checkout_opts opts;
git_reference *head = NULL;
assert(repo && target);
assert(reset_type == GIT_RESET_SOFT
......@@ -49,7 +50,10 @@ int git_reset(
//TODO: Check for unmerged entries
if (git_reference__update(repo, git_object_id(commit), GIT_HEAD_FILE) < 0)
if (git_repository_head(&head, repo) < 0)
goto cleanup;
if (git_reference_set_oid(head, git_object_id(commit)) < 0)
goto cleanup;
if (reset_type == GIT_RESET_SOFT) {
......@@ -96,6 +100,7 @@ int git_reset(
error = 0;
cleanup:
git_reference_free(head);
git_object_free(commit);
git_index_free(index);
git_tree_free(tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment