summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Casey <casey@nrlssc.navy.mil>2008-10-14 20:30:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-10-15 00:18:29 (GMT)
commitc82efafcfa741cdddbc68379c1905953f58ef21d (patch)
tree3fc11660fed02a252141b22e41bc6c6f315780b0
parent4e6d4bc0f0f1388dfcad2af4804b35289ed4ec92 (diff)
downloadgit-c82efafcfa741cdddbc68379c1905953f58ef21d.zip
git-c82efafcfa741cdddbc68379c1905953f58ef21d.tar.gz
git-c82efafcfa741cdddbc68379c1905953f58ef21d.tar.bz2
remote.c: correct the check for a leading '/' in a remote name
This test is supposed to disallow remote entries in the config file of the form: [remote "/foobar"] ... The leading slash in '/foobar' is not acceptable. Instead it was incorrectly testing that the subkey had no leading '/', which had no effect since the subkey pointer was made to point at a '.' in the preceding lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--remote.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/remote.c b/remote.c
index 105668f..7688f3b 100644
--- a/remote.c
+++ b/remote.c
@@ -342,13 +342,14 @@ static int handle_config(const char *key, const char *value, void *cb)
if (prefixcmp(key, "remote."))
return 0;
name = key + 7;
+ if (*name == '/') {
+ warning("Config remote shorthand cannot begin with '/': %s",
+ name);
+ return 0;
+ }
subkey = strrchr(name, '.');
if (!subkey)
return error("Config with no key for remote %s", name);
- if (*subkey == '/') {
- warning("Config remote shorthand cannot begin with '/': %s", name);
- return 0;
- }
remote = make_remote(name, subkey - name);
if (!strcmp(subkey, ".mirror"))
remote->mirror = git_config_bool(key, value);