Skip to content

Commit e05d9ae

Browse files
committed
Merge 'case-insensitive-abspath' into HEAD
2 parents adb934d + f7c6ef1 commit e05d9ae

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int abspath_part_inside_repo(char *path)
3636
off = offset_1st_component(path);
3737

3838
/* check if work tree is already the prefix */
39-
if (wtlen <= len && !strncmp(path, work_tree, wtlen)) {
39+
if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {
4040
if (path[wtlen] == '/') {
4141
memmove(path, path + wtlen + 1, len - wtlen);
4242
return 0;
@@ -56,7 +56,7 @@ static int abspath_part_inside_repo(char *path)
5656
path++;
5757
if (*path == '/') {
5858
*path = '\0';
59-
if (strcmp(real_path(path0), work_tree) == 0) {
59+
if (fspathcmp(real_path(path0), work_tree) == 0) {
6060
memmove(path0, path + 1, len - (path - path0));
6161
return 0;
6262
}
@@ -65,7 +65,7 @@ static int abspath_part_inside_repo(char *path)
6565
}
6666

6767
/* check whole path */
68-
if (strcmp(real_path(path0), work_tree) == 0) {
68+
if (fspathcmp(real_path(path0), work_tree) == 0) {
6969
*path0 = '\0';
7070
return 0;
7171
}

t/t3700-add.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,11 @@ test_expect_success 'all statuses changed in folder if . is given' '
403403
test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0
404404
'
405405

406+
test_expect_success MINGW 'path is case-insensitive' '
407+
path="$(pwd -W)/BLUB" &&
408+
touch "$path" &&
409+
downcased="$(echo "$path" | tr A-Z a-z)" &&
410+
git add "$downcased"
411+
'
412+
406413
test_done

0 commit comments

Comments
 (0)