diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-11-14 11:46:18 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-16 13:15:14 +0900 |
commit | 3e42cb3b67bef525d4bd8416d44ac1f1a1f7a495 (patch) | |
tree | 74c95d587f11d1c793dfec97ac7e983412cc34b9 /builtin/clone.c | |
parent | cae598d9980661a978e2df4fb338518f7bf09572 (diff) | |
download | git-3e42cb3b67bef525d4bd8416d44ac1f1a1f7a495.tar.gz |
clone: use a more appropriate variable name for the default refspec
cmd_clone() declares two strbufs 'key' and 'value' on the same line,
suggesting that they are used to contruct a config variable's name and
value. However, this is not the case: 'key' is used to construct the
names of multiple config variables, while 'value' is never used as a
value for any of those config variables, or for any other config
variable for that matter, but only to contruct the default fetch
refspec.
Let's rename 'value' to 'default_refspec' to make the intent clearer.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index fd2c3ef090..290ddc2e5a 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -889,7 +889,8 @@ 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 default_refspec = STRBUF_INIT; struct strbuf branch_top = STRBUF_INIT, reflog_msg = STRBUF_INIT; struct transport *transport = NULL; const char *src_ref_prefix = "refs/heads/"; @@ -1066,7 +1067,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); @@ -1080,9 +1080,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix) if (option_required_reference.nr || option_optional_reference.nr) setup_reference(); - refspec_append(&rs, value.buf); - - strbuf_reset(&value); + strbuf_addf(&default_refspec, "+%s*:%s*", src_ref_prefix, + branch_top.buf); + refspec_append(&rs, default_refspec.buf); remote = remote_get(option_origin); transport = transport_get(remote, remote->url[0]); @@ -1239,7 +1239,7 @@ 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); + strbuf_release(&default_refspec); junk_mode = JUNK_LEAVE_ALL; refspec_clear(&rs); |