diff options
author | schu <schu-github@schulog.org> | 2011-08-10 16:19:42 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-11-06 03:15:19 +0100 |
commit | a46ec45746f965f2895098e058979225d92d66e5 (patch) | |
tree | 85169e6f62855d3c96df73a474d410660ec0f2b3 /src/commit.c | |
parent | d3104fa0a3f3711729b45346e475354440d46cc3 (diff) | |
download | libgit2-a46ec45746f965f2895098e058979225d92d66e5.tar.gz |
refs: split internal and external references
Currently libgit2 shares pointers to its internal reference cache with
the user. This leads to several problems like invalidation of reference
pointers when reordering the cache or manipulation of the cache from
user side.
Give each user its own git_reference instead of leaking the internal
representation (struct reference).
Add the following new API functions:
* git_reference_free
* git_reference_is_packed
Signed-off-by: schu <schu-github@schulog.org>
Diffstat (limited to 'src/commit.c')
-rw-r--r-- | src/commit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/commit.c b/src/commit.c index b9eb3650..1010fdc5 100644 --- a/src/commit.c +++ b/src/commit.c @@ -137,12 +137,13 @@ int git_commit_create( if (error == GIT_SUCCESS && update_ref != NULL) { git_reference *head; + git_reference *target; error = git_reference_lookup(&head, repo, update_ref); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to create commit"); - error = git_reference_resolve(&head, head); + error = git_reference_resolve(&target, head); if (error < GIT_SUCCESS) { if (error != GIT_ENOTFOUND) return git__rethrow(error, "Failed to create commit"); @@ -156,7 +157,7 @@ int git_commit_create( return git_reference_create_oid(&head, repo, git_reference_target(head), oid, 1); } - error = git_reference_set_oid(head, oid); + error = git_reference_set_oid(target, oid); } if (error < GIT_SUCCESS) |