Skip to content

Commit

Permalink
remote.c: correct the check for a leading '/' in a remote name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Oct 15, 2008
1 parent 4e6d4bc commit c82efaf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c82efaf

Please sign in to comment.