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:
authorFelipe Contreras <felipe.contreras@gmail.com>2021-05-31 22:51:18 +0300
committerJunio C Hamano <gitster@pobox.com>2021-06-02 04:12:01 +0300
commitd371a9ef4cfc4610989b0a3d71c79cbe19e0073a (patch)
treecef1d164928012fcb55b076f4f87d6492f4b8723 /builtin/push.c
parent00458dc5f191f52ef965ca7185b739e8c800b7cb (diff)
push: trivial simplifications
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/builtin/push.c b/builtin/push.c
index 933b1cc6c0..43c039a2e3 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -205,14 +205,12 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
static const char *setup_push_upstream(struct remote *remote, struct branch *branch,
int same_remote)
{
- const char *upstream_ref;
- upstream_ref = get_upstream_ref(branch, remote->name);
if (!same_remote)
die(_("You are pushing to remote '%s', which is not the upstream of\n"
"your current branch '%s', without telling me what to push\n"
"to update which remote branch."),
remote->name, branch->name);
- return upstream_ref;
+ return get_upstream_ref(branch, remote->name);
}
static const char *setup_push_current(struct remote *remote, struct branch *branch)
@@ -222,15 +220,9 @@ static const char *setup_push_current(struct remote *remote, struct branch *bran
static const char *setup_push_simple(struct remote *remote, struct branch *branch, int same_remote)
{
- if (same_remote) {
- const char *upstream_ref;
-
- upstream_ref = get_upstream_ref(branch, remote->name);
-
- /* Additional safety */
- if (strcmp(branch->refname, upstream_ref))
+ if (same_remote)
+ if (strcmp(branch->refname, get_upstream_ref(branch, remote->name)))
die_push_simple(branch, remote);
- }
return branch->refname;
}