Allow all non-zero returns to cancel transfers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
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;
}