Commit def60ea4731368fa3624cb6cbdc704d3dfcbc458

Ben Straub 2013-02-05T13:14:48

Allow all non-zero returns to cancel transfers

diff --git a/src/indexer.c b/src/indexer.c
index 08c88ba..4ff5e72 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -536,7 +536,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
 		}
 		stats->received_objects++;
 
-		if (do_progress_callback(idx, stats) < 0) {
+		if (do_progress_callback(idx, stats) != 0) {
 			error = GIT_EUSER;
 			goto on_error;
 		}
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index a68d242..103fc1e 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -493,7 +493,7 @@ int git_smart__download_pack(
 			git__free(pkt);
 		} else if (pkt->type == GIT_PKT_DATA) {
 			git_pkt_data *p = (git_pkt_data *) pkt;
-			if ((error = writepack->add(writepack, p->data, p->len, stats)) < 0)
+			if ((error = writepack->add(writepack, p->data, p->len, stats)) != 0)
 				goto on_error;
 
 			git__free(pkt);
diff --git a/tests-clar/online/clone.c b/tests-clar/online/clone.c
index 020c29e..c1a9a9a 100644
--- a/tests-clar/online/clone.c
+++ b/tests-clar/online/clone.c
@@ -189,7 +189,7 @@ static int cancel_at_half(const git_transfer_progress *stats, void *payload)
 	GIT_UNUSED(payload);
 
 	if (stats->received_objects > (stats->total_objects/2))
-		return -1;
+		return 1;
 	return 0;
 }