git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 19/23] http-push.c::fetch_symref(): use the new http API
@ 2009-06-05 16:05 Tay Ray Chuan
  2009-06-05 20:54 ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Tay Ray Chuan @ 2009-06-05 16:05 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Johannes Schindelin, Mike Hommey

From:	Mike Hommey <mh@glandium.org>
Subject: [WIP Patch 09/12] Use the new http API in fetch_symref()
Date:	Sun, 18 Jan 2009 09:04:34 +0100

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http-push.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/http-push.c b/http-push.c
index 455e0aa..1714e4e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2029,27 +2029,13 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
 {
 	char *url;
 	struct strbuf buffer = STRBUF_INIT;
-	struct active_request_slot *slot;
-	struct slot_results results;

 	url = xmalloc(strlen(repo->url) + strlen(path) + 1);
 	sprintf(url, "%s%s", repo->url, path);

-	slot = get_active_slot();
-	slot->results = &results;
-	curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
-	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
-	curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
-	curl_easy_setopt(slot->curl, CURLOPT_URL, url);
-	if (start_active_slot(slot)) {
-		run_active_slot(slot);
-		if (results.curl_result != CURLE_OK) {
-			die("Couldn't get %s for remote symref\n%s",
-			    url, curl_errorstr);
-		}
-	} else {
-		die("Unable to start remote symref request");
-	}
+	if (http_get_strbuf(url, &buffer, 0) != HTTP_OK)
+		die("Couldn't get %s for remote symref\n%s", url,
+		    curl_errorstr);
 	free(url);

 	free(*symref);
--
1.6.3.1

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

* Re: [PATCH 19/23] http-push.c::fetch_symref(): use the new http API
  2009-06-05 16:05 [PATCH 19/23] http-push.c::fetch_symref(): use the new http API Tay Ray Chuan
@ 2009-06-05 20:54 ` Jakub Narebski
  2009-06-06  1:02   ` Tay Ray Chuan
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2009-06-05 20:54 UTC (permalink / raw)
  To: Tay Ray Chuan
  Cc: Git Mailing List, Junio C Hamano, Johannes Schindelin,
	Mike Hommey

Tay Ray Chuan <rctay89@gmail.com> writes:

> From:	Mike Hommey <mh@glandium.org>
> Subject: [WIP Patch 09/12] Use the new http API in fetch_symref()

What is the subject of this patch:
  "http-push.c::fetch_symref(): use the new http API"
or
  "Use the new http API in fetch_symref()"

> Date:	Sun, 18 Jan 2009 09:04:34 +0100
> 
> Signed-off-by: Mike Hommey <mh@glandium.org>
> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
> ---

If you wanted to note old subject, it would be better to put it in
comments (here).

>  http-push.c |   20 +++-----------------
>  1 files changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/http-push.c b/http-push.c
> index 455e0aa..1714e4e 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -2029,27 +2029,13 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
>  {
>  	char *url;
>  	struct strbuf buffer = STRBUF_INIT;
> -	struct active_request_slot *slot;
> -	struct slot_results results;
> 
>  	url = xmalloc(strlen(repo->url) + strlen(path) + 1);
>  	sprintf(url, "%s%s", repo->url, path);
> 
> -	slot = get_active_slot();
> -	slot->results = &results;
> -	curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
> -	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
> -	curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
> -	curl_easy_setopt(slot->curl, CURLOPT_URL, url);
> -	if (start_active_slot(slot)) {
> -		run_active_slot(slot);
> -		if (results.curl_result != CURLE_OK) {
> -			die("Couldn't get %s for remote symref\n%s",
> -			    url, curl_errorstr);
> -		}
> -	} else {
> -		die("Unable to start remote symref request");
> -	}
> +	if (http_get_strbuf(url, &buffer, 0) != HTTP_OK)
> +		die("Couldn't get %s for remote symref\n%s", url,
> +		    curl_errorstr);
>  	free(url);
> 
>  	free(*symref);
> --
> 1.6.3.1
> 

-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: [PATCH 19/23] http-push.c::fetch_symref(): use the new http API
  2009-06-05 20:54 ` Jakub Narebski
@ 2009-06-06  1:02   ` Tay Ray Chuan
  2009-06-06  5:32     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Tay Ray Chuan @ 2009-06-06  1:02 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Git Mailing List, Junio C Hamano, Johannes Schindelin,
	Mike Hommey

Hi,

On Sat, Jun 6, 2009 at 4:54 AM, Jakub Narebski<jnareb@gmail.com> wrote:
>> From: Mike Hommey <mh@glandium.org>
>> Subject: [WIP Patch 09/12] Use the new http API in fetch_symref()
>
> What is the subject of this patch:
>  "http-push.c::fetch_symref(): use the new http API"
> or
>  "Use the new http API in fetch_symref()"
> [...]
> If you wanted to note old subject, it would be better to put it in
> comments (here).

Since the title of the patch differed from Mike's original, I was
afraid the attribution to the author's original patch was lost on the
reader of the commit message, thus I added the original subject, in
addition to the author and date, into the commit message.

I didn't add the subject line in Mike's other patches, like patch #11,
because the title of the original patch and the current one are the
same, so it's easy for readers to know what patch is being attributed
to.

-- 
Cheers,
Ray Chuan

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

* Re: [PATCH 19/23] http-push.c::fetch_symref(): use the new http API
  2009-06-06  1:02   ` Tay Ray Chuan
@ 2009-06-06  5:32     ` Junio C Hamano
  2009-06-06  7:20       ` Tay Ray Chuan
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2009-06-06  5:32 UTC (permalink / raw)
  To: Tay Ray Chuan
  Cc: Jakub Narebski, Git Mailing List, Johannes Schindelin,
	Mike Hommey

Tay Ray Chuan <rctay89@gmail.com> writes:

> On Sat, Jun 6, 2009 at 4:54 AM, Jakub Narebski<jnareb@gmail.com> wrote:
>>> From: Mike Hommey <mh@glandium.org>
>>> Subject: [WIP Patch 09/12] Use the new http API in fetch_symref()
>>
>> What is the subject of this patch:
>>  "http-push.c::fetch_symref(): use the new http API"
>> or
>>  "Use the new http API in fetch_symref()"
>> [...]
>> If you wanted to note old subject, it would be better to put it in
>> comments (here).
>
> Since the title of the patch differed from Mike's original, I was
> afraid the attribution to the author's original patch was lost on the
> reader of the commit message, thus I added the original subject, in
> addition to the author and date, into the commit message.

Please don't.

If you chose to use a better (in your opinion) subject from the original
one, we'd want to have that improved one in our commit.  The same thing if
you chose to rewrite the proposed commit log message, or the contents of
the patch, to add your own improvement.  That is what we review here, and
if people think your submitted version is good, that is what we want to
record as a commit.

So, in general we would want to see something like this:

(1)     From: Tay Ray Chuan <rctay89@gmail.com>
        Subject: [PATCH 19/23] http-push.c:fetch_symref(): use the new HTTP API

(2)     From: Mike Hommey <mh@glandium.org>

(3)     Now the contents of a file can be slurped into a strbuf with a single
        call to http_get_strbuf(), use it to simplify fetch_symref().

(4)     Signed-off-by: Mike Hommey <mh@glandium.org>
        Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
(5)     ---
(6)      This is based on Mike's earlier patch:

         Subject: [WIP Patch 09/12] Use the new http API in fetch_symref()
         Date:  Sun, 18 Jan 2009 09:04:34 +0100

         I retitlted Mike's patch in order to ...
         Also changed frotz and nitfol so that they distim doshes better...

(7)     http-push.c |   20 +++-----------------
         1 files changed, 3 insertions(+), 17 deletions(-)

(8)     diff --git a/http-push.c b/http-push.c
        ...

That is,

    (1) RFC2822 headers your MUA gives us;

    (2) In-body (fake)headers for From: if the author is different from
        what (1) records.  If you are forwarding somebody else's patch
        verbatim without modification, you may want to add Date: to keep
        the original datestamp, but if you are sending a version with your
        own improvements, we would rather use the Date: recorded in (1) in
        the final commit.

    (3) Proposed commit log message;

    (4) Chain of Signed-off-by lines;

    (5) Three-dash separator;

    (6) Commentary to explain the history of the patch, and/or background
        information if necessary,

    (7) diffstat;

    (8) the patch itself.

Thanks.

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

* Re: [PATCH 19/23] http-push.c::fetch_symref(): use the new http API
  2009-06-06  5:32     ` Junio C Hamano
@ 2009-06-06  7:20       ` Tay Ray Chuan
  0 siblings, 0 replies; 6+ messages in thread
From: Tay Ray Chuan @ 2009-06-06  7:20 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jakub Narebski, Git Mailing List, Johannes Schindelin,
	Mike Hommey

Hi,

On Sat, Jun 6, 2009 at 1:32 PM, Junio C Hamano<gitster@pobox.com> wrote:
> Please don't.

Ok.

>    (5) Three-dash separator;
>
>    (6) Commentary to explain the history of the patch, and/or background
>        information if necessary,

Is there anyway git can store and display these "commentaries"? I find
myself having to repeatedly write this.

-- 
Cheers,
Ray Chuan

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

* [PATCH 19/23] http-push.c::fetch_symref(): use the new http API
       [not found] <cover.1244277116.git.rctay89@gmail.com>
@ 2009-06-06  8:43 ` Tay Ray Chuan
  0 siblings, 0 replies; 6+ messages in thread
From: Tay Ray Chuan @ 2009-06-06  8:43 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Johannes Schindelin, Mike Hommey

From:	Mike Hommey <mh@glandium.org>

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---

This is based on Mike's earlier patch:

Subject: [WIP Patch 09/12] Use the new http API in fetch_symref()
Date:	Sun, 18 Jan 2009 09:04:34 +0100

 http-push.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/http-push.c b/http-push.c
index 455e0aa..1714e4e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2029,27 +2029,13 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
 {
 	char *url;
 	struct strbuf buffer = STRBUF_INIT;
-	struct active_request_slot *slot;
-	struct slot_results results;

 	url = xmalloc(strlen(repo->url) + strlen(path) + 1);
 	sprintf(url, "%s%s", repo->url, path);

-	slot = get_active_slot();
-	slot->results = &results;
-	curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
-	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
-	curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
-	curl_easy_setopt(slot->curl, CURLOPT_URL, url);
-	if (start_active_slot(slot)) {
-		run_active_slot(slot);
-		if (results.curl_result != CURLE_OK) {
-			die("Couldn't get %s for remote symref\n%s",
-			    url, curl_errorstr);
-		}
-	} else {
-		die("Unable to start remote symref request");
-	}
+	if (http_get_strbuf(url, &buffer, 0) != HTTP_OK)
+		die("Couldn't get %s for remote symref\n%s", url,
+		    curl_errorstr);
 	free(url);

 	free(*symref);
--
1.6.3.1

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

end of thread, other threads:[~2009-06-06  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05 16:05 [PATCH 19/23] http-push.c::fetch_symref(): use the new http API Tay Ray Chuan
2009-06-05 20:54 ` Jakub Narebski
2009-06-06  1:02   ` Tay Ray Chuan
2009-06-06  5:32     ` Junio C Hamano
2009-06-06  7:20       ` Tay Ray Chuan
     [not found] <cover.1244277116.git.rctay89@gmail.com>
2009-06-06  8:43 ` Tay Ray Chuan

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).