{"thread":{"id":"46182","subject":"[PATCH] builtin/clone: get rid of 'value' strbuf","startedAt":"2017-06-14T15:02:07Z","lastAt":"2017-06-15T22:10:22Z","messageCount":2,"participants":["Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"322263","messageId":"20170614150148.29298-1-chriscool@tuxfamily.org","threadId":"46182","inReplyTo":null,"subject":"[PATCH] builtin/clone: get rid of 'value' strbuf","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-06-14T15:01:48Z","receivedAt":"2017-06-14T15:02:07Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This makes the code simpler by removing a few lines, and getting\nrid of one variable.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin/clone.c | 9 +++------\n 1 file changed, 3 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex a2ea019c59..370a233d22 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -870,7 +870,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \tconst struct ref *our_head_points_at;\n \tstruct ref *mapped_refs;\n \tconst struct ref *ref;\n-\tstruct strbuf key = STRBUF_INIT, value = STRBUF_INIT;\n+\tstruct strbuf key = STRBUF_INIT;\n \tstruct strbuf branch_top = STRBUF_INIT, reflog_msg = STRBUF_INIT;\n \tstruct transport *transport = NULL;\n \tconst char *src_ref_prefix = \"refs/heads/\";\n@@ -1035,7 +1035,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\tstrbuf_addf(&branch_top, \"refs/remotes/%s/\", option_origin);\n \t}\n \n-\tstrbuf_addf(&value, \"+%s*:%s*\", src_ref_prefix, branch_top.buf);\n \tstrbuf_addf(&key, \"remote.%s.url\", option_origin);\n \tgit_config_set(key.buf, repo);\n \tstrbuf_reset(&key);\n@@ -1049,10 +1048,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \tif (option_required_reference.nr || option_optional_reference.nr)\n \t\tsetup_reference();\n \n-\tfetch_pattern = value.buf;\n+\tfetch_pattern = xstrfmt(\"+%s*:%s*\", src_ref_prefix, branch_top.buf);\n \trefspec = parse_fetch_refspec(1, &fetch_pattern);\n-\n-\tstrbuf_reset(&value);\n+\tfree((char *)fetch_pattern);\n \n \tremote = remote_get(option_origin);\n \ttransport = transport_get(remote, remote->url[0]);\n@@ -1191,7 +1189,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \tstrbuf_release(&reflog_msg);\n \tstrbuf_release(&branch_top);\n \tstrbuf_release(&key);\n-\tstrbuf_release(&value);\n \tjunk_mode = JUNK_LEAVE_ALL;\n \n \tfree(refspec);\n-- \n2.13.1.453.g04e95ab038\n\n"},{"id":"322408","messageId":"xmqq1sqkzyux.fsf@gitster.mtv.corp.google.com","threadId":"46182","inReplyTo":"20170614150148.29298-1-chriscool@tuxfamily.org","subject":"Re: [PATCH] builtin/clone: get rid of 'value' strbuf","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-15T22:10:14Z","receivedAt":"2017-06-15T22:10:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> This makes the code simpler by removing a few lines, and getting\n> rid of one variable.\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n\nThis patch may have meant well, but I think e5698f3a (\"clone:\nrespect additional configured fetch refspecs during initial fetch\",\n2017-05-30) makes this change a moot point.\n\ncf. https://public-inbox.org/git/20170530071244.32257-1-szeder.dev@gmail.com/\n\nThanks.\n\n\n\n"}]}