* [PATCH] builtin/clone: get rid of 'value' strbuf
@ 2017-06-14 15:01 Christian Couder
2017-06-15 22:10 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2017-06-14 15:01 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Christian Couder
This makes the code simpler by removing a few lines, and getting
rid of one variable.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/clone.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index a2ea019c59..370a233d22 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -870,7 +870,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
const struct ref *our_head_points_at;
struct ref *mapped_refs;
const struct ref *ref;
- struct strbuf key = STRBUF_INIT, value = STRBUF_INIT;
+ struct strbuf key = STRBUF_INIT;
struct strbuf branch_top = STRBUF_INIT, reflog_msg = STRBUF_INIT;
struct transport *transport = NULL;
const char *src_ref_prefix = "refs/heads/";
@@ -1035,7 +1035,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_addf(&branch_top, "refs/remotes/%s/", option_origin);
}
- strbuf_addf(&value, "+%s*:%s*", src_ref_prefix, branch_top.buf);
strbuf_addf(&key, "remote.%s.url", option_origin);
git_config_set(key.buf, repo);
strbuf_reset(&key);
@@ -1049,10 +1048,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (option_required_reference.nr || option_optional_reference.nr)
setup_reference();
- fetch_pattern = value.buf;
+ fetch_pattern = xstrfmt("+%s*:%s*", src_ref_prefix, branch_top.buf);
refspec = parse_fetch_refspec(1, &fetch_pattern);
-
- strbuf_reset(&value);
+ free((char *)fetch_pattern);
remote = remote_get(option_origin);
transport = transport_get(remote, remote->url[0]);
@@ -1191,7 +1189,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_release(&reflog_msg);
strbuf_release(&branch_top);
strbuf_release(&key);
- strbuf_release(&value);
junk_mode = JUNK_LEAVE_ALL;
free(refspec);
--
2.13.1.453.g04e95ab038
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] builtin/clone: get rid of 'value' strbuf
2017-06-14 15:01 [PATCH] builtin/clone: get rid of 'value' strbuf Christian Couder
@ 2017-06-15 22:10 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2017-06-15 22:10 UTC (permalink / raw)
To: Christian Couder; +Cc: git, Christian Couder
Christian Couder <christian.couder@gmail.com> writes:
> This makes the code simpler by removing a few lines, and getting
> rid of one variable.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
This patch may have meant well, but I think e5698f3a ("clone:
respect additional configured fetch refspecs during initial fetch",
2017-05-30) makes this change a moot point.
cf. https://public-inbox.org/git/20170530071244.32257-1-szeder.dev@gmail.com/
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-15 22:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 15:01 [PATCH] builtin/clone: get rid of 'value' strbuf Christian Couder
2017-06-15 22:10 ` Junio C Hamano
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).