Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad8509e

Browse files
committed
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.
1 parent 16604d7 commit ad8509e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ v0.23 + 1
4141
with which to implement the transactional/atomic semantics for the
4242
configuration backend.
4343

44-
* `git_index_add` will now use the case as provided by the caller on
45-
case insensitive systems. Previous versions would keep the case as
46-
it existed in the index. This does not affect the higher-level
47-
`git_index_add_bypath` or `git_index_add_frombuffer` functions.
44+
* `git_index_add` and `git_index_conflict_add()` will now use the case
45+
as provided by the caller on case insensitive systems. Previous
46+
versions would keep the case as it existed in the index. This does
47+
not affect the higher-level `git_index_add_bypath` or
48+
`git_index_add_frombuffer` functions.
4849

4950
* The `notify_payload` field of `git_diff_options` was renamed to `payload`
5051
to reflect that it's also the payload for the new progress callback.

src/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,7 @@ int git_index_conflict_add(git_index *index,
17181718
/* Make sure stage is correct */
17191719
GIT_IDXENTRY_STAGE_SET(entries[i], i + 1);
17201720

1721-
if ((ret = index_insert(index, &entries[i], 0, true, true)) < 0)
1721+
if ((ret = index_insert(index, &entries[i], 1, true, true)) < 0)
17221722
goto on_error;
17231723

17241724
entries[i] = NULL; /* don't free if later entry fails */

0 commit comments

Comments
 (0)