From 956d27a872a70f40f98c3f710553ef619959e212 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Sat, 6 Jun 2009 17:16:30 +0200 Subject: builtin-remote: Make "remote show" display all urls Currently, "git remote -v" lists all urls whereas "git remote show $remote" shows only the first. Make it so that both show all. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano diff --git a/builtin-remote.c b/builtin-remote.c index fda9a54..d436412 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -1003,9 +1003,12 @@ static int show(int argc, const char **argv) get_remote_ref_states(*argv, &states, query_flag); - printf("* remote %s\n URL: %s\n", *argv, - states.remote->url_nr > 0 ? - states.remote->url[0] : "(no URL)"); + printf("* remote %s\n", *argv); + if (states.remote->url_nr) { + for (i=0; i < states.remote->url_nr; i++) + printf(" URL: %s\n", states.remote->url[i]); + } else + printf(" URL: %s\n", "(no URL)"); if (no_query) printf(" HEAD branch: (not queried)\n"); else if (!states.heads.nr) -- cgit v0.10.2-6-g49f6 From 3ef67cf250b14b9c62b2bd21e4d0d5339f5f31e5 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 8 Jun 2009 10:51:22 +0200 Subject: fetch-pack: close output channel after sideband demultiplexer terminates fetch-pack runs the sideband demultiplexer using start_async(). This facility requires that the asynchronously executed function closes the output file descriptor (see Documentation/technical/api-run-command.txt). But the sideband demultiplexer did not do that. This fixes it. In certain error situations this could lock up a fetch operation on Windows because the asynchronous function is run in a thread; by not closing the output fd the reading end never got EOF and waited for more data indefinitely. On Unix this is not a problem because the asynchronous function is run in a separate process, which exits after the function ends and so implicitly closes the output. Since the pack that is sent over the wire encodes the number of objects in the stream, during normal operation the reading end knows when the stream ends and terminates by itself, and does not lock up. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 6202462..629735f 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -483,7 +483,9 @@ static int sideband_demux(int fd, void *data) { int *xd = data; - return recv_sideband("fetch-pack", xd[0], fd); + int ret = recv_sideband("fetch-pack", xd[0], fd); + close(fd); + return ret; } static int get_pack(int xd[2], char **pack_lockfile) -- cgit v0.10.2-6-g49f6 From 802f9c9cb21321d3ffe7576e01bbe31c51bd4c70 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 8 Jun 2009 22:34:30 +0200 Subject: diff.c: plug a memory leak in an error path Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano diff --git a/diff.c b/diff.c index d24bff1..f0b580c 100644 --- a/diff.c +++ b/diff.c @@ -3590,6 +3590,7 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec, if (start_command(&child) != 0 || strbuf_read(&buf, child.out, 0) < 0 || finish_command(&child) != 0) { + strbuf_release(&buf); remove_tempfile(); error("error running textconv command '%s'", pgm); return NULL; -- cgit v0.10.2-6-g49f6