summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-11 19:00:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-11 21:11:37 (GMT)
commitd2370cc2960d3b0a090c57dfea99209c59b515f7 (patch)
tree11217c91d247cac99812d36b5a07b7e546345801
parente098368b5b990eb05cbc60a271ab6d731820e0c2 (diff)
downloadgit-d2370cc2960d3b0a090c57dfea99209c59b515f7.zip
git-d2370cc2960d3b0a090c57dfea99209c59b515f7.tar.gz
git-d2370cc2960d3b0a090c57dfea99209c59b515f7.tar.bz2
remote.c: guard config parser from value=NULL
branch.*.{remote,merge} expect a string value Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--remote.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/remote.c b/remote.c
index 0e00680..20abbc0 100644
--- a/remote.c
+++ b/remote.c
@@ -222,15 +222,18 @@ static int handle_config(const char *key, const char *value)
subkey = strrchr(name, '.');
if (!subkey)
return 0;
- if (!value)
- return 0;
branch = make_branch(name, subkey - name);
if (!strcmp(subkey, ".remote")) {
+ if (!value)
+ return config_error_nonbool(key);
branch->remote_name = xstrdup(value);
if (branch == current_branch)
default_remote_name = branch->remote_name;
- } else if (!strcmp(subkey, ".merge"))
+ } else if (!strcmp(subkey, ".merge")) {
+ if (!value)
+ return config_error_nonbool(key);
add_merge(branch, xstrdup(value));
+ }
return 0;
}
if (prefixcmp(key, "remote."))