summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Olivier Latour <pol@mac.com>2015-03-11 19:29:36 -0700
committerPierre-Olivier Latour <pol@mac.com>2015-03-11 19:29:36 -0700
commit8a3934e49b6bdbaa5c3c3f419258b44280d4122c (patch)
tree4f429bfe193cd8a1be8fcf23e7f8adf5196cb083
parent15f581747c57f1bb5f3c3a173139789ec759c964 (diff)
downloadlibgit2-8a3934e49b6bdbaa5c3c3f419258b44280d4122c.tar.gz
Avoid retaining / releasing the index more than necessary when GIT_DIFF_UPDATE_INDEX is enabled
-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);
}
}