[PATCH] remote.c: guard config parser from value=NULL
From: Govind Salinas <hidden>
Date: 2016-06-15 22:44:12
Subsystem:
the rest · Maintainer:
Linus Torvalds
Note:Moved multiple checks for null to one place at the top of the function. Comment in this section conflicted with Junio's request to remove this behavior. Signed-off-by: Govind Salinas <redacted> --- remote.c | 19 ++----------------- 1 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/remote.c b/remote.c
index 0e00680..27cdaa7 100644
--- a/remote.c
+++ b/remote.c@@ -217,13 +217,13 @@ static int handle_config(const char *key, constchar *value)
const char *subkey;
struct remote *remote;
struct branch *branch;
+ if (!value)
+ return 0;
if (!prefixcmp(key, "branch.")) {
name = key + 7;
subkey = strrchr(name, '.');
if (!subkey)
return 0;
- if (!value)
- return 0;
branch = make_branch(name, subkey - name);
if (!strcmp(subkey, ".remote")) {
branch->remote_name = xstrdup(value);@@ -244,21 +244,6 @@ static int handle_config(const char *key, constchar *value)
return 0;
}
remote = make_remote(name, subkey - name);
- if (!value) {
- /* if we ever have a boolean variable, e.g. "remote.*.disabled"
- * [remote "frotz"]
- * disabled
- * is a valid way to set it to true; we get NULL in value so
- * we need to handle it here.
- *
- * if (!strcmp(subkey, ".disabled")) {
- * val = git_config_bool(key, value);
- * return 0;
- * } else
- *
- */
- return 0; /* ignore unknown booleans */
- }
if (!strcmp(subkey, ".url")) {
add_url(remote, xstrdup(value));
} else if (!strcmp(subkey, ".push")) {
--
1.5.4.36.g9af61