Skip to content

Commit bb8cccd

Browse files
moygitster
authored andcommitted
push: Correctly initialize nonfastforward in transport_push.
The variable is assigned unconditionally in print_push_status, but print_push_status is not reached by all codepaths. In particular, this fixes a bug where "git push ... nonexisting-branch" was complaining about non-fast forward. Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cb57220 commit bb8cccd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

transport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,9 @@ int transport_set_option(struct transport *transport,
10011001

10021002
int transport_push(struct transport *transport,
10031003
int refspec_nr, const char **refspec, int flags,
1004-
int * nonfastforward)
1004+
int *nonfastforward)
10051005
{
1006+
*nonfastforward = 0;
10061007
verify_remote_names(refspec_nr, refspec);
10071008

10081009
if (transport->push)

0 commit comments

Comments
 (0)