swh:1:snp:47f1e8bb459169b0feb652a9c3d9cbabd8526d4a
Raw File
Tip revision: fc849d8d6b90e5c1e0c37bc0d60dd92b2fe7347f authored by Junio C Hamano on 23 October 2017, 05:44:17 UTC
Git 2.14.3
Tip revision: fc849d8
cygwin.c
#include "../git-compat-util.h"
#include "../cache.h"

int cygwin_offset_1st_component(const char *path)
{
	const char *pos = path;
	/* unc paths */
	if (is_dir_sep(pos[0]) && is_dir_sep(pos[1])) {
		/* skip server name */
		pos = strchr(pos + 2, '/');
		if (!pos)
			return 0; /* Error: malformed unc path */

		do {
			pos++;
		} while (*pos && pos[0] != '/');
	}
	return pos + is_dir_sep(*pos) - path;
}
back to top