summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-03-15 00:24:36 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-15 00:24:36 +0100
commitd675982a15388d8c413acda139b4662062cf3286 (patch)
tree1ce4e5ed210cc2ff7c6d84b48017906ff2ccc499
parent7c63a33ffe1198b77b481974cd0e74e9ace1745c (diff)
parent8a3934e49b6bdbaa5c3c3f419258b44280d4122c (diff)
downloadlibgit2-d675982a15388d8c413acda139b4662062cf3286.tar.gz
Merge pull request #2975 from git-up/diff_index_retain
Avoid retaining / releasing the index more than necessary when GIT_DIFF_...
-rw-r--r--src/diff.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c
index 9432b0467..f1bc28fd9 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -620,10 +620,9 @@ int git_diff__oid_for_entry(
if (!error && update_match && git_oid_equal(out, update_match)) {
git_index *idx;
- if (!(error = git_repository_index(&idx, diff->repo))) {
+ if (!(error = git_repository_index__weakptr(&idx, diff->repo))) {
memcpy(&entry.id, out, sizeof(entry.id));
error = git_index_add(idx, &entry);
- git_index_free(idx);
}
}