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:21 +0300
committerJunio C Hamano <gitster@pobox.com>2021-06-02 04:12:02 +0300
commit1afd78fb5c29b8ad95de072bb8a0edacc69db61a (patch)
treebb354abd69366e493db1c351ff747563b83b7da9 /builtin/push.c
parent1f934725f7597366c981b72be6597124e2c21a77 (diff)
push: remove redundant check
If fetch_remote is NULL (i.e. the branch remote is invalid), then it can't possibly be same as remote, which can't be NULL. The check is redundant, and so is the extra variable. Also, fix the Yoda condition: we want to check if remote is the same as the branch remote, not the other way around. 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.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/push.c b/builtin/push.c
index b5e951bf59..aa22d6a8e5 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -204,8 +204,7 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
static int is_same_remote(struct remote *remote)
{
- struct remote *fetch_remote = remote_get(NULL);
- return (!fetch_remote || fetch_remote == remote);
+ return remote == remote_get(NULL);
}
static void setup_default_push_refspecs(struct remote *remote)