summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ca496e)
raw | patch | inline | side by side (parent: 8ca496e)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Fri, 15 Feb 2008 19:14:18 +0000 (14:14 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 15 Feb 2008 22:23:22 +0000 (14:23 -0800) |
The original problem was that the parsers for configuration files were
getting confused by seeing as nicknames remotes that involved
directory-changing characters. In particular, the branches config file
for ".." was particularly mystifying on platforms that can open
directories and read odd data from them.
The validation function was written by Junio Hamano (with a typo
corrected).
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
getting confused by seeing as nicknames remotes that involved
directory-changing characters. In particular, the branches config file
for ".." was particularly mystifying on platforms that can open
directories and read odd data from them.
The validation function was written by Junio Hamano (with a typo
corrected).
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c | patch | blob | history |
diff --git a/remote.c b/remote.c
index 20abbc07acb2e48aefb2129683b5dc159661211e..6b56473f5bb7d8ab2226ed83805f30c9e21ba773 100644 (file)
--- a/remote.c
+++ b/remote.c
return rs;
}
+static int valid_remote_nick(const char *name)
+{
+ if (!name[0] || /* not empty */
+ (name[0] == '.' && /* not "." */
+ (!name[1] || /* not ".." */
+ (name[1] == '.' && !name[2]))))
+ return 0;
+ return !strchr(name, '/'); /* no slash */
+}
+
struct remote *remote_get(const char *name)
{
struct remote *ret;
if (!name)
name = default_remote_name;
ret = make_remote(name, 0);
- if (name[0] != '/') {
+ if (valid_remote_nick(name)) {
if (!ret->url)
read_remotes_file(ret);
if (!ret->url)