Revision 42e6fde5c28150206956ea4be490d886c4ecbd68 authored by Junio C Hamano on 22 September 2017, 05:49:24 UTC, committed by Junio C Hamano on 22 September 2017, 05:49:24 UTC
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1df0306
Raw File
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