48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
|
```
Note how line numbers above and below the `~~~~~` (diff chunk separator) are consecutive. fossil(1) doesn't do that because it handles the chunk separator at a higher level of the API, whereas libf moves that into the diff builder interface. That change requires that libf forego a step fossil performs which tries to merge chunks of a diff together if the distance between them is smaller than the number of context lines. That change in libf is apparently the root cause of this. It's purely cosmetic, but it's annoying. The core of the discrepancy comes from fossil mixing the output of of the diffs: most of it is done from the diff builders but some pieces, like Unified-format diff line number markers, are output from the core diff driver algorithm. That gives it more control over the output, but it also only supports a single output channel (a memory buffer), whereas libf needs to be able to support arbitrary output channels (some of which, like ncurses widgets, cannot simply be streamed-to).
TODO: figure out how to adapt libf to (A) not require that the higher-level API know such details about the diff builder but (B) still be able to apply that "cosmetic optimization."
Checkin [](08fdbacefacd2b) partially resolves this, but only for the case when we're using line numbers (as in the above example).
## The Unusually and Excessively Large Diff
Here's a case where libf's diff (via f-vdiff) produces a multi-hundred-meg diff compared to half a meg for fossil...
To reproduce, from the main fossil tree:
```
$ fossil co c800d2ca827c1fe5f
$ fossil merge 9769c4f7563 # results are the same with f-merge
$ f-vdiff -f u > X
$ fossil diff --unified > Y
$ ls -la X Y
-rw-rw-r-- 1 stephan stephan 282218662 Jan 15 10:34 X
-rw-rw-r-- 1 stephan stephan 584208 Jan 15 10:35 Y
```
_!?!?!?_ The root cause is as yet unknown. Results are similar with other diff formats.
## Backports from Fossil
This list is for potential backports from fossil which should be investigated more closely to determine whether they need to be adapted for use in this library:
- Improved diff output with `--from BRANCH` when it names a branch which was just merged into the local checkout: <s>[](fossil:edb3a3a06369c1e7bd29)</s>
[](fossil:960c9e8bd69531eb)
# f-apps-specific
## f-vdiff
#### Recognize Renames
|