diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-15 15:43:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-15 15:43:39 -0700 |
commit | 6652939ce8cacb147bce2f0c3503486915ca5a73 (patch) | |
tree | 51c9658810c142612d479319c11b9dd7a2767c64 /dir.c | |
parent | 7f11b485215be205f498fe646a7adc8c8b5386a5 (diff) | |
parent | 63ec5e1fecc14b0dd5452f0a2b80641600b03437 (diff) | |
download | git-6652939ce8cacb147bce2f0c3503486915ca5a73.tar.gz |
Merge branch 'js/icase-wt-detection'
On a case insensitive filesystems, setting GIT_WORK_TREE variable
using a random cases that does not agree with what the filesystem
thinks confused Git that it wasn't inside the working tree.
* js/icase-wt-detection:
setup: fix "inside work tree" detection on case-insensitive filesystems
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -2107,6 +2107,15 @@ int file_exists(const char *f) return lstat(f, &sb) == 0; } +static int cmp_icase(char a, char b) +{ + if (a == b) + return 0; + if (ignore_case) + return toupper(a) - toupper(b); + return a - b; +} + /* * Given two normalized paths (a trailing slash is ok), if subdir is * outside dir, return -1. Otherwise return the offset in subdir that @@ -2118,7 +2127,7 @@ int dir_inside_of(const char *subdir, const char *dir) assert(dir && subdir && *dir && *subdir); - while (*dir && *subdir && *dir == *subdir) { + while (*dir && *subdir && !cmp_icase(*dir, *subdir)) { dir++; subdir++; offset++; |