Skip to content

Commit

Permalink
Merge 'case-insensitive-abspath' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
dscho committed Oct 17, 2017
2 parents b2d9bdd + 11e6dd2 commit 49873d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static int abspath_part_inside_repo(char *path)
off = offset_1st_component(path);

/* check if work tree is already the prefix */
if (wtlen <= len && !strncmp(path, work_tree, wtlen)) {
if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {
if (path[wtlen] == '/') {
memmove(path, path + wtlen + 1, len - wtlen);
return 0;
Expand All @@ -58,7 +58,7 @@ static int abspath_part_inside_repo(char *path)
path++;
if (*path == '/') {
*path = '\0';
if (strcmp(real_path(path0), work_tree) == 0) {
if (fspathcmp(real_path(path0), work_tree) == 0) {
memmove(path0, path + 1, len - (path - path0));
return 0;
}
Expand All @@ -67,7 +67,7 @@ static int abspath_part_inside_repo(char *path)
}

/* check whole path */
if (strcmp(real_path(path0), work_tree) == 0) {
if (fspathcmp(real_path(path0), work_tree) == 0) {
*path0 = '\0';
return 0;
}
Expand Down
7 changes: 7 additions & 0 deletions t/t3700-add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,11 @@ test_expect_success 'all statuses changed in folder if . is given' '
test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0
'

test_expect_success MINGW 'path is case-insensitive' '
path="$(pwd -W)/BLUB" &&
touch "$path" &&
downcased="$(echo "$path" | tr A-Z a-z)" &&
git add "$downcased"
'

test_done

0 comments on commit 49873d3

Please sign in to comment.