Thread (17 messages) flat view 17 messages, 6 authors, 2016-06-15

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

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:58:44

Possibly related (same subject, not in this thread)

Am 12.09.2013 16:13, schrieb Torsten Bögershausen:
On 2013-09-12 11.12, Jiang Xin wrote:
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help