# [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.

6 messages from 2008-04-19 to 2008-04-20. Participants: Tordek, Junio C Hamano, Christian Couder, Stephan Beyer.
Thread: https://gitlist.dev/t/13182

## Tordek, 2008-04-19 22:39

Subject: [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.
Message-ID: <480A7499.1040705@gmail.com>
URL: https://gitlist.dev/e/480A7499.1040705%40gmail.com

```
Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
---
My apologies, I had made a mistake on the previous attempt.

  http.c |   36 ++++++++++++------------------------
  1 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/http.c b/http.c
index 256a5f1..8ae6432 100644
--- a/http.c
+++ b/http.c
@@ -13,14 +13,14 @@ static CURL *curl_default;
  char curl_errorstr[CURL_ERROR_SIZE];

  static int curl_ssl_verify = -1;
-static char *ssl_cert = NULL;
+static const char *ssl_cert = NULL;
  #if LIBCURL_VERSION_NUM >= 0x070902
-static char *ssl_key = NULL;
+static const char *ssl_key = NULL;
  #endif
  #if LIBCURL_VERSION_NUM >= 0x070908
-static char *ssl_capath = NULL;
+static const char *ssl_capath = NULL;
  #endif
-static char *ssl_cainfo = NULL;
+static const char *ssl_cainfo = NULL;
  static long curl_low_speed_limit = -1;
  static long curl_low_speed_time = -1;
  static int curl_ftp_no_epsv = 0;
@@ -100,39 +100,27 @@ static int http_options(const char *var, const 
char *value)
  	}

  	if (!strcmp("http.sslcert", var)) {
-		if (ssl_cert == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_cert = xstrdup(value);
-		}
+		if (ssl_cert == NULL)
+			return git_config_string(&ssl_cert, var, value);
  		return 0;
  	}
  #if LIBCURL_VERSION_NUM >= 0x070902
  	if (!strcmp("http.sslkey", var)) {
-		if (ssl_key == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_key = xstrdup(value);
-		}
+		if (ssl_key == NULL)
+			return git_config_string(&ssl_key, var, value);
  		return 0;
  	}
  #endif
  #if LIBCURL_VERSION_NUM >= 0x070908
  	if (!strcmp("http.sslcapath", var)) {
-		if (ssl_capath == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_capath = xstrdup(value);
-		}
+		if (ssl_capath == NULL)
+			return git_config_string(&ssl_capath, var, value);
  		return 0;
  	}
  #endif
  	if (!strcmp("http.sslcainfo", var)) {
-		if (ssl_cainfo == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_cainfo = xstrdup(value);
-		}
+		if (ssl_cainfo == NULL)
+			return git_config_string(&ssl_cainfo, var, value);
  		return 0;
  	}

-- 
1.5.2.2

```

## Junio C Hamano, 2008-04-20 03:30

Subject: Re: [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.
Message-ID: <7vwsmtdwy4.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwsmtdwy4.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <480A7499.1040705@gmail.com>

```
Tordek <kedrot@gmail.com> writes:

> Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
> ---
> My apologies, I had made a mistake on the previous attempt.

Heh, Christian, doesn't this patch look _suspiciously_ familiar ;-)?

cf.

 $gmane/79392 aka Message-Id: <7vskxqe0db.fsf@gitster.siamese.dyndns.org>

```

## Christian Couder, 2008-04-20 04:06

Subject: Re: [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.
Message-ID: <20080420060629.38407fe1.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20080420060629.38407fe1.chriscool%40tuxfamily.org
In-Reply-To: <480A7499.1040705@gmail.com>

```
On Sat, 19 Apr 2008 19:39:21 -0300
Tordek <kedrot@gmail.com> wrote:

> Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
> ---
> My apologies, I had made a mistake on the previous attempt.
>
>   http.c |   36 ++++++++++++------------------------
>   1 files changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/http.c b/http.c
> index 256a5f1..8ae6432 100644
> --- a/http.c
> +++ b/http.c
> @@ -13,14 +13,14 @@ static CURL *curl_default;
>   char curl_errorstr[CURL_ERROR_SIZE];
   ^
There is one spurious whitespace before "char" in the above line.

>   static int curl_ssl_verify = -1;
   ^
In the above line too.

> -static char *ssl_cert = NULL;
> +static const char *ssl_cert = NULL;

These 2 lines above are fine.

>   #if LIBCURL_VERSION_NUM >= 0x070902
   ^
Here again there is one spurious whitespace.

[...]

>   static long curl_low_speed_time = -1;
>   static int curl_ftp_no_epsv = 0;
> @@ -100,39 +100,27 @@ static int http_options(const char *var, const 
> char *value)

"char *value)" should have stayed on the same line as "http_options(const char *var, const ".

Please try to send yourself your own patch and try to apply it using "git am", before you send it to the list. 

Thanks,
Christian.

```

## Tordek, 2008-04-20 07:10

Subject: Re: [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.
Message-ID: <b362b0fe0804200010t465b49absba03102cb1364021@mail.gmail.com>
URL: https://gitlist.dev/e/b362b0fe0804200010t465b49absba03102cb1364021%40mail.gmail.com
In-Reply-To: <b362b0fe0804192354x2e91e45asca5dc74208e7be68@mail.gmail.com>

```
Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
---
Okay, I'm skipping the middleman this time; Thunderbird mangles patches...
 http.c |   36 ++++++++++++------------------------
 1 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/http.c b/http.c
index 256a5f1..8ae6432 100644
--- a/http.c
+++ b/http.c
@@ -13,14 +13,14 @@ static CURL *curl_default;
 char curl_errorstr[CURL_ERROR_SIZE];

 static int curl_ssl_verify = -1;
-static char *ssl_cert = NULL;
+static const char *ssl_cert = NULL;
 #if LIBCURL_VERSION_NUM >= 0x070902
-static char *ssl_key = NULL;
+static const char *ssl_key = NULL;
 #endif
 #if LIBCURL_VERSION_NUM >= 0x070908
-static char *ssl_capath = NULL;
+static const char *ssl_capath = NULL;
 #endif
-static char *ssl_cainfo = NULL;
+static const char *ssl_cainfo = NULL;
 static long curl_low_speed_limit = -1;
 static long curl_low_speed_time = -1;
 static int curl_ftp_no_epsv = 0;
@@ -100,39 +100,27 @@ static int http_options(const char *var, const
char *value)
 	}

 	if (!strcmp("http.sslcert", var)) {
-		if (ssl_cert == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_cert = xstrdup(value);
-		}
+		if (ssl_cert == NULL)
+			return git_config_string(&ssl_cert, var, value);
 		return 0;
 	}
 #if LIBCURL_VERSION_NUM >= 0x070902
 	if (!strcmp("http.sslkey", var)) {
-		if (ssl_key == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_key = xstrdup(value);
-		}
+		if (ssl_key == NULL)
+			return git_config_string(&ssl_key, var, value);
 		return 0;
 	}
 #endif
 #if LIBCURL_VERSION_NUM >= 0x070908
 	if (!strcmp("http.sslcapath", var)) {
-		if (ssl_capath == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_capath = xstrdup(value);
-		}
+		if (ssl_capath == NULL)
+			return git_config_string(&ssl_capath, var, value);
 		return 0;
 	}
 #endif
 	if (!strcmp("http.sslcainfo", var)) {
-		if (ssl_cainfo == NULL) {
-			if (!value)
-				return config_error_nonbool(var);
-			ssl_cainfo = xstrdup(value);
-		}
+		if (ssl_cainfo == NULL)
+			return git_config_string(&ssl_cainfo, var, value);
 		return 0;
 	}

-- 
1.5.2.2

```

## Stephan Beyer, 2008-04-20 13:54

Subject: Re: [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.
Message-ID: <20080420135412.GA7667@leksak.fem-net>
URL: https://gitlist.dev/e/20080420135412.GA7667%40leksak.fem-net
In-Reply-To: <7vwsmtdwy4.fsf@gitster.siamese.dyndns.org>

```
Hi,

> Heh, Christian, doesn't this patch look _suspiciously_ familiar ;-)?

Yes, you've put a bunch of `sample solutions' to the list and everyone who
is able to search Gmane efficiently can find it.  But now I wouldn't say 
that other solutions are cherry-picked from your sample solution even if
they look similar. ;-)

Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

```

## Junio C Hamano, 2008-04-20 16:26

Subject: Re: [PATCH (try 3)] http.c: 'use_git_config_string' on configuration options.
Message-ID: <7viqyccx27.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7viqyccx27.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <480A7499.1040705@gmail.com>

```
Tordek <kedrot@gmail.com> writes:

> Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
> ---
> My apologies, I had made a mistake on the previous attempt.

Please make up your mind as to who you want to claim to be.

Are you "Tordek <kedrot@gmail.com>" without first-last name, or are you
"Guillermo O Freschi <tordek@tordek.com.ar>"?

I suspect the latter, but in that case, it is easier for me if you add an
extra From: header at the top of the message.  In other words, do this:

(The mail header, RFC 2822)
	From: Tordek <kedrot@gmail.com>
	Subject: [PATCH] http.c: use git_config_string() for parsing
	Date: .....

(The mail body)
	From: Guillermo O. Freschi <tordek@tordek.com.ar>

	<<explain what the patch does here>>

	Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
	---
	<<commentary, if any>>
	 <<diffstat>>
	 <<diff>>

```
