Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-11-26 18:18:28 +0300
committerJunio C Hamano <gitster@pobox.com>2019-11-27 05:18:39 +0300
commit1768aaf01d3f57af8c4182d5887d219456f4a094 (patch)
tree163a8f5c4202b4b65c8d7f703cd0c0972203271a /builtin/push.c
parentec6ee0c07a6dc93dd18003b069c78f514ccbe427 (diff)
push: use skip_prefix() instead of starts_with()
Get rid of a magic number by using skip_prefix(). Signed-off-by: René Scharfe <l.s.r@web.de> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/push.c b/builtin/push.c
index 843f5b22a2..6dbf0f0bb7 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -64,6 +64,7 @@ static struct string_list push_options_config = STRING_LIST_INIT_DUP;
static const char *map_refspec(const char *ref,
struct remote *remote, struct ref *local_refs)
{
+ const char *branch_name;
struct ref *matched = NULL;
/* Does "ref" uniquely name our ref? */
@@ -84,8 +85,8 @@ static const char *map_refspec(const char *ref,
}
if (push_default == PUSH_DEFAULT_UPSTREAM &&
- starts_with(matched->name, "refs/heads/")) {
- struct branch *branch = branch_get(matched->name + 11);
+ skip_prefix(matched->name, "refs/heads/", &branch_name)) {
+ struct branch *branch = branch_get(branch_name);
if (branch->merge_nr == 1 && branch->merge[0]->src) {
struct strbuf buf = STRBUF_INIT;
strbuf_addf(&buf, "%s:%s",