{"thread":{"id":"11979","subject":"[PATCH] remote.c: guard config parser from value=NULL","startedAt":"2008-02-09T00:38:19Z","lastAt":"2008-02-09T00:38:19Z","messageCount":1,"participants":["Govind Salinas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"68034","messageId":"5d46db230802081638u415871e4i6fc67a98d5ccf0b3@mail.gmail.com","threadId":"11979","inReplyTo":null,"subject":"[PATCH] remote.c: guard config parser from value=NULL","fromName":"Govind Salinas","fromEmail":"blix@sophiasuchtig.com","sentAt":"2008-02-09T00:38:19Z","receivedAt":"2008-02-09T00:38:19Z","isPatch":true,"sender":{"key":"blix@sophiasuchtig.com","avatar":null},"body":"Note:Moved multiple checks for null to one place at the top of the function.\nComment in this section conflicted with Junio's request to remove this\nbehavior.\n\nSigned-off-by: Govind Salinas <blix@sophiasuchtig.com>\n---\n remote.c |   19 ++-----------------\n 1 files changed, 2 insertions(+), 17 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex 0e00680..27cdaa7 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -217,13 +217,13 @@ static int handle_config(const char *key, const\nchar *value)\n \tconst char *subkey;\n \tstruct remote *remote;\n \tstruct branch *branch;\n+\tif (!value)\n+\t\treturn 0;\n \tif (!prefixcmp(key, \"branch.\")) {\n \t\tname = key + 7;\n \t\tsubkey = strrchr(name, '.');\n \t\tif (!subkey)\n \t\t\treturn 0;\n-\t\tif (!value)\n-\t\t\treturn 0;\n \t\tbranch = make_branch(name, subkey - name);\n \t\tif (!strcmp(subkey, \".remote\")) {\n \t\t\tbranch->remote_name = xstrdup(value);\n@@ -244,21 +244,6 @@ static int handle_config(const char *key, const\nchar *value)\n \t\treturn 0;\n \t}\n \tremote = make_remote(name, subkey - name);\n-\tif (!value) {\n-\t\t/* if we ever have a boolean variable, e.g. \"remote.*.disabled\"\n-\t\t * [remote \"frotz\"]\n-\t\t *      disabled\n-\t\t * is a valid way to set it to true; we get NULL in value so\n-\t\t * we need to handle it here.\n-\t\t *\n-\t\t * if (!strcmp(subkey, \".disabled\")) {\n-\t\t *      val = git_config_bool(key, value);\n-\t\t *      return 0;\n-\t\t * } else\n-\t\t *\n-\t\t */\n-\t\treturn 0; /* ignore unknown booleans */\n-\t}\n \tif (!strcmp(subkey, \".url\")) {\n \t\tadd_url(remote, xstrdup(value));\n \t} else if (!strcmp(subkey, \".push\")) {\n-- \n1.5.4.36.g9af61\n"}]}