index: overwrite the path when inserting conflicts

When we insert a conflict in a case-insensitive index, accept the
new entry's path as the correct case instead of leaving the path we
already had.

This puts `git_index_conflict_add()` on the same level as
`git_index_add()` in this respect.
This commit is contained in:
Carlos Martín Nieto 2015-11-12 11:54:06 +01:00
parent 16604d7469
commit ad8509ef9f
2 changed files with 6 additions and 5 deletions

View File

@ -41,10 +41,11 @@ v0.23 + 1
with which to implement the transactional/atomic semantics for the with which to implement the transactional/atomic semantics for the
configuration backend. configuration backend.
* `git_index_add` will now use the case as provided by the caller on * `git_index_add` and `git_index_conflict_add()` will now use the case
case insensitive systems. Previous versions would keep the case as as provided by the caller on case insensitive systems. Previous
it existed in the index. This does not affect the higher-level versions would keep the case as it existed in the index. This does
`git_index_add_bypath` or `git_index_add_frombuffer` functions. not affect the higher-level `git_index_add_bypath` or
`git_index_add_frombuffer` functions.
* The `notify_payload` field of `git_diff_options` was renamed to `payload` * The `notify_payload` field of `git_diff_options` was renamed to `payload`
to reflect that it's also the payload for the new progress callback. to reflect that it's also the payload for the new progress callback.

View File

@ -1718,7 +1718,7 @@ int git_index_conflict_add(git_index *index,
/* Make sure stage is correct */ /* Make sure stage is correct */
GIT_IDXENTRY_STAGE_SET(entries[i], i + 1); GIT_IDXENTRY_STAGE_SET(entries[i], i + 1);
if ((ret = index_insert(index, &entries[i], 0, true, true)) < 0) if ((ret = index_insert(index, &entries[i], 1, true, true)) < 0)
goto on_error; goto on_error;
entries[i] = NULL; /* don't free if later entry fails */ entries[i] = NULL; /* don't free if later entry fails */