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>

Felipe Contreras committed May 31, 2021 at 14:51 UTC 1afd78fb5c29b8ad95de072bb8a0edacc69db61a
1 file changed +1 -2
builtin/push.c
+1 -2
@@ -204,8 +204,7 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
204
205 static int is_same_remote(struct remote *remote)
206 {
207 - struct remote *fetch_remote = remote_get(NULL);
208 - return (!fetch_remote || fetch_remote == remote);
207 + return remote == remote_get(NULL);
208 }
209
210 static void setup_default_push_refspecs(struct remote *remote)