git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remote.c: guard config parser from value=NULL
  2008-02-08  6:43 [Janitors] value could be NULL in config parser Junio C Hamano
@ 2008-02-08 14:26 ` Miklos Vajna
  2008-02-08 16:34   ` Michele Ballabio
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Vajna @ 2008-02-08 14:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 remote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/remote.c b/remote.c
index 0e00680..4765815 100644
--- a/remote.c
+++ b/remote.c
@@ -276,7 +276,7 @@ static int handle_config(const char *key, const char *value)
 		else
 			error("more than one uploadpack given, using the first");
 	} else if (!strcmp(subkey, ".tagopt")) {
-		if (!strcmp(value, "--no-tags"))
+		if (value && !strcmp(value, "--no-tags"))
 			remote->fetch_tags = -1;
 	} else if (!strcmp(subkey, ".proxy")) {
 		remote->http_proxy = xstrdup(value);
-- 
1.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] remote.c: guard config parser from value=NULL
  2008-02-08 14:26 ` [PATCH] remote.c: guard config parser from value=NULL Miklos Vajna
@ 2008-02-08 16:34   ` Michele Ballabio
  0 siblings, 0 replies; 3+ messages in thread
From: Michele Ballabio @ 2008-02-08 16:34 UTC (permalink / raw)
  To: git; +Cc: Miklos Vajna, Junio C Hamano

On Friday 08 February 2008, Miklos Vajna wrote:
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>  remote.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/remote.c b/remote.c
> index 0e00680..4765815 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -276,7 +276,7 @@ static int handle_config(const char *key, const char *value)
>  		else
>  			error("more than one uploadpack given, using the first");
>  	} else if (!strcmp(subkey, ".tagopt")) {
> -		if (!strcmp(value, "--no-tags"))
> +		if (value && !strcmp(value, "--no-tags"))
>  			remote->fetch_tags = -1;
>  	} else if (!strcmp(subkey, ".proxy")) {
>  		remote->http_proxy = xstrdup(value);

Function handle_config() has already returned 0 at this point.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] remote.c: guard config parser from value=NULL
@ 2008-02-09  0:38 Govind Salinas
  0 siblings, 0 replies; 3+ messages in thread
From: Govind Salinas @ 2008-02-09  0:38 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

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 <blix@sophiasuchtig.com>
---
 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, const
char *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, const
char *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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-09  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-09  0:38 [PATCH] remote.c: guard config parser from value=NULL Govind Salinas
  -- strict thread matches above, loose matches on Subject: below --
2008-02-08  6:43 [Janitors] value could be NULL in config parser Junio C Hamano
2008-02-08 14:26 ` [PATCH] remote.c: guard config parser from value=NULL Miklos Vajna
2008-02-08 16:34   ` Michele Ballabio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).