diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-09-22 14:47:17 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-10-07 23:03:49 +0400 |
commit | a147408f944abb67e1a4a50071c9bb0a20c57e98 (patch) | |
tree | 3e4a25c1fddfb06a850b7e866b3298af2848711f /src/reset.c | |
parent | b52b6571afc96006de69aac77c8a9f97b3ebb9d3 (diff) |
reset: make reset rely on git_repository_head()
Diffstat (limited to 'src/reset.c')
-rw-r--r-- | src/reset.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/reset.c b/src/reset.c index 4ce21e2cf..c536e75b8 100644 --- a/src/reset.c +++ b/src/reset.c @@ -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); |