Skip to content

The diff implementation is different than diff #40

Description

@hannesm

If we take file1:

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

and file2:

1
2
3
4
5
6
7
8
9
hi
11
12
13
14
15
16
17
18
19
hi
21
22
23
24
25

the diff generated by normal diff -u is:

--- hunks.old
+++ hunks.new
@@ -7,7 +7,7 @@
 7
 8
 9
-10
+hi
 11
 12
 13
@@ -17,7 +17,7 @@
 17
 18
 19
-20
+hi
 21
 22
 23

but our diff generates the following:

--- hunks.old
+++ hunks.new
@@ -10,16 +10,16 @@
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
+hi
+11
+12
+13
+14
+15
+16
+17
+18
+19
+hi
+21
+22
+23
+24
+25

-> missing context (the three lines before the change), and we could emit multiple hunks...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions