Commit d675982a by Carlos Martín Nieto

Merge pull request #2975 from git-up/diff_index_retain

Avoid retaining / releasing the index more than necessary when GIT_DIFF_...
parents 7c63a33f 8a3934e4
...@@ -620,10 +620,9 @@ int git_diff__oid_for_entry( ...@@ -620,10 +620,9 @@ int git_diff__oid_for_entry(
if (!error && update_match && git_oid_equal(out, update_match)) { if (!error && update_match && git_oid_equal(out, update_match)) {
git_index *idx; 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)); memcpy(&entry.id, out, sizeof(entry.id));
error = git_index_add(idx, &entry); error = git_index_add(idx, &entry);
git_index_free(idx);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment