Skip to content

Make alternates work on UNC paths #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compat/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ HANDLE winansi_get_osfhandle(int fd);
*/

#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
#define has_unc_prefix(path) (*(path) == '\\' && (path)[1] == '\\')
#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 @@ -337,6 +337,14 @@ static inline int git_has_dos_drive_prefix(const char *path)
#define has_dos_drive_prefix git_has_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
2 changes: 1 addition & 1 deletion path.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)
{
char *dst0;

if (has_dos_drive_prefix(src)) {
if (has_unc_prefix(src) || has_dos_drive_prefix(src)) {
*dst++ = *src++;
*dst++ = *src++;
}
Expand Down