summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cancellation.h2
-rw-r--r--src/diff_generate.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/cancellation.h b/src/cancellation.h
index d447e00c6..fbb6fbc54 100644
--- a/src/cancellation.h
+++ b/src/cancellation.h
@@ -14,7 +14,7 @@
/**
* Check whether there's an active cancellation that's been canceled.
*/
-GIT_INLINE(bool) git_cancellation__cancelled(void)
+GIT_INLINE(bool) git_cancellation__canceled(void)
{
git_cancellation *c = GIT_GLOBAL->cancellation;
diff --git a/src/diff_generate.c b/src/diff_generate.c
index 06f9b19c7..4858c43c0 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -16,6 +16,7 @@
#include "index.h"
#include "odb.h"
#include "submodule.h"
+#include "cancellation.h"
#define DIFF_FLAG_IS_SET(DIFF,FLAG) \
(((DIFF)->base.opts.flags & (FLAG)) != 0)
@@ -1212,6 +1213,12 @@ int git_diff__from_iterators(
while (!error && (info.oitem || info.nitem)) {
int cmp;
+ if (git_cancellation__canceled()) {
+ giterr_set(GITERR_CANCELLATION, "the operation was canceled");
+ error = GIT_ECANCELLED;
+ goto cleanup;
+ }
+
/* report progress */
if (opts && opts->progress_cb) {
if ((error = opts->progress_cb(&diff->base,