{"thread":{"id":"11873","subject":"[PATCH 2/2] Clean up connection correctly if object fetch wasn't done","startedAt":"2008-02-04T18:26:29Z","lastAt":"2008-02-04T21:21:39Z","messageCount":4,"participants":["Daniel Barkalow","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"67398","messageId":"alpine.LNX.1.00.0802041326260.13593@iabervon.org","threadId":"11873","inReplyTo":null,"subject":"[PATCH 2/2] Clean up connection correctly if object fetch wasn't done","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-04T18:26:29Z","receivedAt":"2008-02-04T18:26:29Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"Further optimization allowed the fetch_objs call to be skipped if it\nisn't necessary. However, this leaves the connection in need of\ncleaning up to avoid getting an error message from the remote end when\nssh is used. Fix this.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n builtin-fetch.c |    2 ++\n transport.c     |   10 +++++++++-\n 2 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex 320e235..ac335f2 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -557,6 +557,8 @@ static int do_fetch(struct transport *transport,\n \n \tfree_refs(fetch_map);\n \n+\ttransport_disconnect(transport);\n+\n \treturn 0;\n }\n \ndiff --git a/transport.c b/transport.c\nindex 53fb2ec..199e9e6 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -677,7 +677,15 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const\n \n static int disconnect_git(struct transport *transport)\n {\n-\tfree(transport->data);\n+\tstruct git_transport_data *data = transport->data;\n+\tif (data->conn) {\n+\t\tpacket_flush(data->fd[1]);\n+\t\tclose(data->fd[0]);\n+\t\tclose(data->fd[1]);\n+\t\tfinish_connect(data->conn);\n+\t}\n+\n+\tfree(data);\n \treturn 0;\n }\n \n-- \n1.5.4\n"},{"id":"67413","messageId":"alpine.LSU.1.00.0802042023160.8543@racer.site","threadId":"11873","inReplyTo":"alpine.LNX.1.00.0802041326260.13593@iabervon.org","subject":"Re: [PATCH 2/2] Clean up connection correctly if object fetch wasn't done","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T20:23:55Z","receivedAt":"2008-02-04T20:23:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Daniel Barkalow wrote:\n\n> Further optimization allowed the fetch_objs call to be skipped if it \n> isn't necessary. However, this leaves the connection in need of cleaning \n> up to avoid getting an error message from the remote end when ssh is \n> used. Fix this.\n\nI _think_ something similar is necessary for ls-remote, too (at least it \nshowed the same symptoms today, but I have not had time to investigate \nyet).\n\nCiao,\nDscho\n"},{"id":"67427","messageId":"alpine.LNX.1.00.0802041602020.13593@iabervon.org","threadId":"11873","inReplyTo":"alpine.LSU.1.00.0802042023160.8543@racer.site","subject":"Re: [PATCH 2/2] Clean up connection correctly if object fetch wasn't done","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-04T21:06:41Z","receivedAt":"2008-02-04T21:06:41Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 4 Feb 2008, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Mon, 4 Feb 2008, Daniel Barkalow wrote:\n> \n> > Further optimization allowed the fetch_objs call to be skipped if it \n> > isn't necessary. However, this leaves the connection in need of cleaning \n> > up to avoid getting an error message from the remote end when ssh is \n> > used. Fix this.\n> \n> I _think_ something similar is necessary for ls-remote, too (at least it \n> showed the same symptoms today, but I have not had time to investigate \n> yet).\n\nYup, exactly the same change to builtin-ls-remote that builtin-fetch \nneeded.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n\ndiff --git a/builtin-ls-remote.c b/builtin-ls-remote.c\nindex 6dd31d1..0237549 100644\n--- a/builtin-ls-remote.c\n+++ b/builtin-ls-remote.c\n@@ -94,6 +94,7 @@ int cmd_ls_remote(int argc, const char **argv, const \nchar *prefix)\n                transport_set_option(transport, TRANS_OPT_UPLOADPACK, \nuploadpack);\n \n        ref = transport_get_remote_refs(transport);\n+       transport_disconnect(transport);\n \n        if (!ref)\n                return 1;\n"},{"id":"67429","messageId":"alpine.LSU.1.00.0802042118320.8543@racer.site","threadId":"11873","inReplyTo":"alpine.LNX.1.00.0802041602020.13593@iabervon.org","subject":"Re: [PATCH 2/2] Clean up connection correctly if object fetch wasn't done","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T21:21:39Z","receivedAt":"2008-02-04T21:21:39Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Daniel Barkalow wrote:\n\n> On Mon, 4 Feb 2008, Johannes Schindelin wrote:\n> \n> > On Mon, 4 Feb 2008, Daniel Barkalow wrote:\n> > \n> > > Further optimization allowed the fetch_objs call to be skipped if it \n> > > isn't necessary. However, this leaves the connection in need of \n> > > cleaning up to avoid getting an error message from the remote end \n> > > when ssh is used. Fix this.\n> > \n> > I _think_ something similar is necessary for ls-remote, too (at least \n> > it showed the same symptoms today, but I have not had time to \n> > investigate yet).\n> \n> Yup, exactly the same change to builtin-ls-remote that builtin-fetch \n> needed.\n\nThanks, works here.\n\nCiao,\nDscho\n"}]}