Commit Diff


commit - e1595dc1c75393361878450cc70fcefee131810a
commit + 9f5da0913af47a525ab2a2422c7911cdb08866d0
blob - 5e816ae10b5948c0aeacd27365a91f3147b96baf
blob + fa9dc982956eab298f65b4b9ffca114a46b50b76
--- include/diff_main.h
+++ include/diff_main.h
@@ -251,3 +251,4 @@ struct diff_result *diff_main(const struct diff_config
 			      struct diff_data *left,
 			      struct diff_data *right);
 void diff_result_free(struct diff_result *result);
+int diff_result_contains_printable_chunks(struct diff_result *result);
blob - c531ad29bc45c650dd4e3dbc4773479aafd7676b
blob + 325830b65763ecd28f365b69cfc7091b6445971f
--- lib/diff_main.c
+++ lib/diff_main.c
@@ -627,4 +627,20 @@ diff_result_free(struct diff_result *result)
 		return;
 	ARRAYLIST_FREE(result->chunks);
 	free(result);
+}
+
+int
+diff_result_contains_printable_chunks(struct diff_result *result)
+{
+	struct diff_chunk *c;
+	enum diff_chunk_type t;
+
+	for (int i = 0; i < result->chunks.len; i++) {
+		c = &result->chunks.head[i];
+		t = diff_chunk_type(c);
+		if (t == CHUNK_MINUS || t == CHUNK_PLUS)
+			return 1;
+	}
+
+	return 0;
 }