Merge branch 'jc/worktree-add-short-help'
[git] / compat / cygwin.c
1 #include "../git-compat-util.h"
2 #include "../cache.h"
3
4 int 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 }