Skip to content

Commit 7418f1a

Browse files
mhaggergitster
authored andcommitted
cmd_fetch_pack(): return early if finish_connect() fails
This simplifies the logic without changing the behavior. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f537cfa commit 7418f1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/fetch-pack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
10181018
close(fd[0]);
10191019
close(fd[1]);
10201020
if (finish_connect(conn))
1021-
ref = NULL;
1022-
ret = !ref;
1021+
return 1;
10231022

1024-
if (!ret && sought.nr) {
1023+
ret = !ref;
1024+
if (ref && sought.nr) {
10251025
/* If the heads to pull were given, we should have
10261026
* consumed all of them by matching the remote.
10271027
* Otherwise, 'git fetch remote no-such-ref' would

0 commit comments

Comments
 (0)