Commit f4ebb2d4e8d3bb0e0c40737e5807ea1011f7c908

Edward Thomson 2019-01-21T00:56:35

blame: make hunk_cmp handle unsigned differences

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/blame.c b/src/blame.c
index 4e98295..be10c15 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -41,7 +41,12 @@ static int hunk_cmp(const void *_a, const void *_b)
 	git_blame_hunk *a = (git_blame_hunk*)_a,
 						*b = (git_blame_hunk*)_b;
 
-	return a->final_start_line_number - b->final_start_line_number;
+	if (a->final_start_line_number > b->final_start_line_number)
+		return 1;
+	else if (a->final_start_line_number < b->final_start_line_number)
+		return -1;
+	else
+		return 0;
 }
 
 static bool hunk_ends_at_or_before_line(git_blame_hunk *hunk, size_t line)