Skip to content

Commit

Permalink
cmd_fetch_pack(): return early if finish_connect() fails
Browse files Browse the repository at this point in the history
This simplifies the logic without changing the behavior.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Sep 12, 2012
1 parent f537cfa commit 7418f1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin/fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
close(fd[0]);
close(fd[1]);
if (finish_connect(conn))
ref = NULL;
ret = !ref;
return 1;

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

0 comments on commit 7418f1a

Please sign in to comment.