Prepare to start 2.19 cycle
[alt-git.git] / compat / cygwin.c
blobb9862d606d57ac6cb0c788312d86bb6c4e6fdc49
1 #include "../git-compat-util.h"
2 #include "../cache.h"
4 int cygwin_offset_1st_component(const char *path)
6 const char *pos = path;
7 /* unc paths */
8 if (is_dir_sep(pos[0]) && is_dir_sep(pos[1])) {
9 /* skip server name */
10 pos = strchr(pos + 2, '/');
11 if (!pos)
12 return 0; /* Error: malformed unc path */
14 do {
15 pos++;
16 } while (*pos && pos[0] != '/');
18 return pos + is_dir_sep(*pos) - path;