mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Allow using UNC path for git repository
[efl: moved MinGW-specific part to compat/] [jes: fixed compilation on non-Windows] Signed-off-by: Cezary Zawadka <czawadka@gmail.com> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
af3889de8d
commit
e40fa94421
1
cache.h
1
cache.h
|
@ -754,7 +754,6 @@ int normalize_path_copy(char *dst, const char *src);
|
||||||
int longest_ancestor_length(const char *path, const char *prefix_list);
|
int longest_ancestor_length(const char *path, const char *prefix_list);
|
||||||
char *strip_path_suffix(const char *path, const char *suffix);
|
char *strip_path_suffix(const char *path, const char *suffix);
|
||||||
int daemon_avoid_alias(const char *path);
|
int daemon_avoid_alias(const char *path);
|
||||||
int offset_1st_component(const char *path);
|
|
||||||
|
|
||||||
/* object replacement */
|
/* object replacement */
|
||||||
#define READ_SHA1_FILE_REPLACE 1
|
#define READ_SHA1_FILE_REPLACE 1
|
||||||
|
|
|
@ -1839,3 +1839,26 @@ const char *get_windows_home_directory()
|
||||||
|
|
||||||
return home_directory;
|
return home_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mingw_offset_1st_component(const char *path)
|
||||||
|
{
|
||||||
|
if (has_dos_drive_prefix(path))
|
||||||
|
return 2 + is_dir_sep(path[2]);
|
||||||
|
|
||||||
|
/* unc paths */
|
||||||
|
if (is_dir_sep(path[0]) && is_dir_sep(path[1])) {
|
||||||
|
|
||||||
|
/* skip server name */
|
||||||
|
char *pos = strpbrk(path + 2, "\\/");
|
||||||
|
if (!pos)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
pos++;
|
||||||
|
} while (*pos && !is_dir_sep(*pos));
|
||||||
|
|
||||||
|
return pos - path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_dir_sep(path[0]);
|
||||||
|
}
|
||||||
|
|
|
@ -312,6 +312,8 @@ static inline char *mingw_find_last_dir_sep(const char *path)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#define find_last_dir_sep mingw_find_last_dir_sep
|
#define find_last_dir_sep mingw_find_last_dir_sep
|
||||||
|
int mingw_offset_1st_component(const char *path);
|
||||||
|
#define offset_1st_component mingw_offset_1st_component
|
||||||
#define PATH_SEP ';'
|
#define PATH_SEP ';'
|
||||||
#define PRIuMAX "I64u"
|
#define PRIuMAX "I64u"
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,10 @@ extern char *gitbasename(char *);
|
||||||
#define has_dos_drive_prefix(path) 0
|
#define has_dos_drive_prefix(path) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef offset_1st_component
|
||||||
|
#define offset_1st_component(path) (is_dir_sep((path)[0]))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef is_dir_sep
|
#ifndef is_dir_sep
|
||||||
#define is_dir_sep(c) ((c) == '/')
|
#define is_dir_sep(c) ((c) == '/')
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue