swh:1:snp:47f1e8bb459169b0feb652a9c3d9cbabd8526d4a
Raw File
Tip revision: ba6f0905fdb9e65c1ac5fbc79c9a4ef0b59b3e68 authored by Jonathan Nieder on 19 April 2020, 23:24:14 UTC
Git 2.18.4
Tip revision: ba6f090
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