Windows: do not treat a path with backslashes as a remote's nick name
[gitweb.git] / remote.c
index ad6c5424edab2ae15ac17bfcf12ac4ee93b5aa3f..1949882c10a05a1f53b711f6cd3f3e083ca27393 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -645,7 +645,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)