Commit d2b7841d669b0afba5740422958c2c3c2f83dde5

Vicent Marti 2014-03-05T11:37:08

Merge pull request #2161 from softwarenerd/softwarenerd Fixed missing error check on call to git_remote_download

diff --git a/src/remote.c b/src/remote.c
index f320f4a..6f97d56 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -857,12 +857,15 @@ int git_remote_fetch(
 	if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH)) != 0)
 		return error;
 
-	if ((error = git_remote_download(remote)) != 0)
-		return error;
+	error = git_remote_download(remote);
 
 	/* We don't need to be connected anymore */
 	git_remote_disconnect(remote);
 
+	/* If the download failed, return the error */
+	if (error != 0)
+		return error;
+
 	/* Default reflog message */
 	if (reflog_message)
 		git_buf_sets(&reflog_msg_buf, reflog_message);