aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat/mingw.h6
-rw-r--r--remote.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 335016955..e03aecfe2 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -398,7 +398,11 @@ 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 is_dir_sep(c) ((c) == '/' || (c) == '\\')
+static inline int mingw_is_dir_sep(int c)
+{
+ return c == '/' || c == '\\';
+}
+#define is_dir_sep mingw_is_dir_sep
static inline char *mingw_find_last_dir_sep(const char *path)
{
char *ret = NULL;
diff --git a/remote.c b/remote.c
index 72b4591b9..32f137e96 100644
--- a/remote.c
+++ b/remote.c
@@ -649,7 +649,12 @@ static int valid_remote_nick(const char *name)
{
if (!name[0] || is_dot_or_dotdot(name))
return 0;
- return !strchr(name, '/'); /* no slash */
+
+ /* remote nicknames cannot contain slashes */
+ while (*name)
+ if (is_dir_sep(*name++))
+ return 0;
+ return 1;
}
const char *remote_for_branch(struct branch *branch, int *explicit)