Commit d675982a15388d8c413acda139b4662062cf3286

Carlos Martín Nieto 2015-03-15T00:24:36

Merge pull request #2975 from git-up/diff_index_retain Avoid retaining / releasing the index more than necessary when GIT_DIFF_...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/diff.c b/src/diff.c
index 9432b04..f1bc28f 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);
 		}
  	}