Subject: Re: [PATCH 1/2] relative_path should honor dos_drive_prefix

From: Johannes Sixt <[email-masked]>
Date: Thu, 12 Sep 2013 19:22:01 +0200

Am 12.09.2013 16:13, schrieb Torsten Bögershausen:
> 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.

> 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