Skip to content

Commit fd9a097

Browse files
author
Git for Windows Build Agent
committed
Merge 'case-insensitive-abspath' into HEAD
2 parents c2fd11b + 648e718 commit fd9a097

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
@@ -38,7 +38,7 @@ static int abspath_part_inside_repo(char *path)
3838
off = offset_1st_component(path);
3939

4040
/* check if work tree is already the prefix */
41-
if (wtlen <= len && !strncmp(path, work_tree, wtlen)) {
41+
if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {
4242
if (path[wtlen] == '/') {
4343
memmove(path, path + wtlen + 1, len - wtlen);
4444
return 0;
@@ -58,7 +58,7 @@ static int abspath_part_inside_repo(char *path)
5858
path++;
5959
if (*path == '/') {
6060
*path = '\0';
61-
if (strcmp(real_path(path0), work_tree) == 0) {
61+
if (fspathcmp(real_path(path0), work_tree) == 0) {
6262
memmove(path0, path + 1, len - (path - path0));
6363
return 0;
6464
}
@@ -67,7 +67,7 @@ static int abspath_part_inside_repo(char *path)
6767
}
6868

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

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)