Skip to content

Commit

Permalink
Merge 'unc-alternates' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
dscho committed May 20, 2016
2 parents 73ac8c8 + 715e2e2 commit f0ef8a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions compat/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ HANDLE winansi_get_osfhandle(int fd);
(isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
int mingw_skip_dos_drive_prefix(char **path);
#define skip_dos_drive_prefix mingw_skip_dos_drive_prefix
#define has_unc_prefix(path) (*(path) == '\\' && (path)[1] == '\\' ? 2 : 0)
#define is_dir_sep(c) ((c) == '/' || (c) == '\\')
static inline char *mingw_find_last_dir_sep(const char *path)
{
Expand Down
8 changes: 8 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ static inline int git_skip_dos_drive_prefix(char **path)
#define skip_dos_drive_prefix git_skip_dos_drive_prefix
#endif

#ifndef has_unc_prefix
static inline int git_has_unc_prefix(const char *path)
{
return 0;
}
#define has_unc_prefix git_has_unc_prefix
#endif

#ifndef is_dir_sep
static inline int git_is_dir_sep(int c)
{
Expand Down
4 changes: 2 additions & 2 deletions path.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,9 @@ const char *remove_leading_path(const char *in, const char *prefix)
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)
{
char *dst0;
int i;
int i = has_unc_prefix(src);

for (i = has_dos_drive_prefix(src); i > 0; i--)
for (i = i ? i : has_dos_drive_prefix(src); i > 0; i--)
*dst++ = *src++;
dst0 = dst;

Expand Down

0 comments on commit f0ef8a9

Please sign in to comment.