{"thread":{"id":"7886","subject":"[PATCH 5/5] Call send-pack with --remote option","startedAt":"2007-04-28T17:05:22Z","lastAt":"2007-04-29T05:51:53Z","messageCount":2,"participants":["Daniel Barkalow","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"40663","messageId":"Pine.LNX.4.64.0704281304430.28708@iabervon.org","threadId":"7886","inReplyTo":null,"subject":"[PATCH 5/5] Call send-pack with --remote option","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2007-04-28T17:05:22Z","receivedAt":"2007-04-28T17:05:22Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"When calling send-pack from git-push, use the --remote option when\nappropriate.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n builtin-push.c |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 2e944cd..d4734be 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -158,7 +158,7 @@ static int do_push(const char *repo)\n \t\trefspec = remote->push_refspec;\n \t}\n \n-\targv = xmalloc((refspec_nr + 10) * sizeof(char *));\n+\targv = xmalloc((refspec_nr + 11) * sizeof(char *));\n \targv[0] = \"dummy-send-pack\";\n \targc = 1;\n \tif (all)\n@@ -180,8 +180,13 @@ static int do_push(const char *repo)\n \t\tif (!prefixcmp(dest, \"http://\") ||\n \t\t    !prefixcmp(dest, \"https://\"))\n \t\t\tsender = \"http-push\";\n-\t\telse if (thin)\n-\t\t\targv[dest_argc++] = \"--thin\";\n+\t\telse {\n+\t\t\tchar *rem = xmalloc(strlen(remote->name) + 10);\n+\t\t\tsprintf(rem, \"--remote=%s\", remote->name);\n+\t\t\targv[dest_argc++] = rem;\n+\t\t\tif (thin)\n+\t\t\t\targv[dest_argc++] = \"--thin\";\n+\t\t}\n \t\targv[0] = sender;\n \t\targv[dest_argc++] = dest;\n \t\twhile (dest_refspec_nr--)\n-- \n1.5.1.2.255.g6ead4-dirty\n"},{"id":"40689","messageId":"7vps5ng22u.fsf@assigned-by-dhcp.cox.net","threadId":"7886","inReplyTo":"Pine.LNX.4.64.0704281304430.28708@iabervon.org","subject":"Re: [PATCH 5/5] Call send-pack with --remote option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-29T05:51:53Z","receivedAt":"2007-04-29T05:51:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> diff --git a/builtin-push.c b/builtin-push.c\n> index 2e944cd..d4734be 100644\n> --- a/builtin-push.c\n> +++ b/builtin-push.c\n> @@ -158,7 +158,7 @@ static int do_push(const char *repo)\n>  \t\trefspec = remote->push_refspec;\n>  \t}\n>  \n> -\targv = xmalloc((refspec_nr + 10) * sizeof(char *));\n> +\targv = xmalloc((refspec_nr + 11) * sizeof(char *));\n>  \targv[0] = \"dummy-send-pack\";\n>  \targc = 1;\n>  \tif (all)\n\nI somehow thought this 10 was there not because we counted but\nwe know 10 gives us enough slop.  Adding one because we give an\nextra parameter, while it is logically correct, feels somewhat\nfunny.  But I do not have a better suggestion (unless we count\nexactly which we cannot do).\n"}]}