summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-06-02 15:05:58 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-06-02 15:05:58 +0900
commit7d26aa32309a2a5979c4ae4b85b25b20e8aae0d4 (patch)
treed04eae1e3b22448ecac24085db96419c53ddca77 /remote.c
parentFourth batch for 2.14 (diff)
parentWindows: do not treat a path with backslashes as a remote's nick name (diff)
downloadtgif-7d26aa32309a2a5979c4ae4b85b25b20e8aae0d4.tar.xz
Merge branch 'js/bs-is-a-dir-sep-on-windows'
"foo\bar\baz" in "git fetch foo\bar\baz", even though there is no slashes in it, cannot be a nickname for a remote on Windows, as that is likely to be a pathname on a local filesystem. * js/bs-is-a-dir-sep-on-windows: Windows: do not treat a path with backslashes as a remote's nick name mingw.h: permit arguments with side effects for is_dir_sep
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index fdc52d802c..e43b1460f8 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)