Commit 8c13eaedbb85a9f9211559a657c955d93f4af5de

Carlos Martín Nieto 2014-12-14T17:00:54

fetch: prune after updating tips This makes a fetch+prune more similar to a connect+prune and makes it more likely that we see errors in the decision to prune a reference.

diff --git a/src/remote.c b/src/remote.c
index 8ffb894..cd81409 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -926,12 +926,15 @@ int git_remote_fetch(
 				remote->name ? remote->name : remote->url);
 	}
 
-	if (remote->prune_refs && (error = git_remote_prune(remote)) < 0)
-		return error;
-
 	/* Create "remote/foo" branches for all remote branches */
 	error = git_remote_update_tips(remote, signature, git_buf_cstr(&reflog_msg_buf));
 	git_buf_free(&reflog_msg_buf);
+	if (error < 0)
+		return error;
+
+	if (remote->prune_refs)
+		error = git_remote_prune(remote);
+
 	return error;
 }