mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 18:17:54 +00:00
Merge pull request #1040 from ethomson/index_refactor
Free conflict index entries on removal
This commit is contained in:
commit
473a7a1e70
12
src/index.c
12
src/index.c
@ -914,6 +914,7 @@ int git_index_conflict_remove(git_index *index, const char *path)
|
|||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
git_index_entry *conflict_entry;
|
git_index_entry *conflict_entry;
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
assert(index && path);
|
assert(index && path);
|
||||||
|
|
||||||
@ -931,18 +932,23 @@ int git_index_conflict_remove(git_index *index, const char *path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_vector_remove(&index->entries, (unsigned int)pos);
|
error = git_vector_remove(&index->entries, (unsigned int)pos);
|
||||||
|
|
||||||
|
if (error >= 0)
|
||||||
|
index_entry_free(conflict_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int index_conflicts_match(git_vector *v, size_t idx)
|
static int index_conflicts_match(git_vector *v, size_t idx)
|
||||||
{
|
{
|
||||||
git_index_entry *entry = git_vector_get(v, idx);
|
git_index_entry *entry = git_vector_get(v, idx);
|
||||||
|
|
||||||
if (index_entry_stage(entry) > 0)
|
if (index_entry_stage(entry) > 0) {
|
||||||
|
index_entry_free(entry);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user