Re: [PATCH 1/2] relative_path should honor dos_drive_prefix
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Sep 12, 2013, 17:22 UTC
- Message-ID
- <5231F839.3080208@kdbg.org>
- In-Reply-To
- <5231CBFA.3070806@web.de>
Am 12.09.2013 16:13, schrieb Torsten Bögershausen:
Show 10 quoted lines
> On 2013-09-12 11.12, Jiang Xin wrote:
>> +static int have_same_root(const char *path1, const char *path2)
>> +{
>> + int is_abs1, is_abs2;
>> +
>> + is_abs1 = is_absolute_path(path1);
>> + is_abs2 = is_absolute_path(path2);
>> + return (is_abs1 && is_abs2 && !strncasecmp(path1, path2, 1)) ||
> ^^^^^^^^^^^
> I wonder: should strncasecmp() be replaced with strncmp_icase() ?I don't think so: On POSIX, it is irrelevant, because the call will only compare a slash to a slash. On Windows, it compares the drive letters (or a slash); it is *always* case-insensitive, even if the volume mounted is NTFS with case-sensitivity enabled and core.ignorecase is false.
Show 5 quoted lines
> See dir.c:
> int strncmp_icase(const char *a, const char *b, size_t count)
> {
> return ignore_case ? strncasecmp(a, b, count) : strncmp(a, b, count);
> }-- Hannes