]> git.ipfire.org Git - thirdparty/git.git/blame - compat/cygwin.c
Merge branch '2.16' of https://github.com/ChrisADR/git-po
[thirdparty/git.git] / compat / cygwin.c
CommitLineData
496f2569
TB
1#include "../git-compat-util.h"
2#include "../cache.h"
3
4int cygwin_offset_1st_component(const char *path)
5{
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 */
13
14 do {
15 pos++;
16 } while (*pos && pos[0] != '/');
17 }
18 return pos + is_dir_sep(*pos) - path;
19}