Skip to content

Commit 1afd78f

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1f93472 commit 1afd78f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

builtin/push.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
204204

205205
static int is_same_remote(struct remote *remote)
206206
{
207-
struct remote *fetch_remote = remote_get(NULL);
208-
return (!fetch_remote || fetch_remote == remote);
207+
return remote == remote_get(NULL);
209208
}
210209

211210
static void setup_default_push_refspecs(struct remote *remote)

0 commit comments

Comments
 (0)