Skip to content

RFC implement empty line diff chunk heuristic

Jacob Keller git 3 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest2 patches 0 repliesNew
  2. v2 RFC2 patches 2 repliesSuperseded
  3. v1 RFC2 patches 19 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xdiff: add recs_match helper functionxdiff/xdiffi.c+11 -40 replies
2/2xdiff: implement empty line chunk heuristicDocumentation/diff-config.txt Documentation/diff-options.txt diff.c +2 more+51 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [RFC PATCH, WAS: "weird diff output?" v3 0/2] implement empty line diff chunk heuristic

From: Jacob Keller <[email protected]>

Third version of my series with a few more minor fixups. I left the diff command line and configuration option alone for now, suspecting that long term we either (a) remove it or (b) use a gitattribute, so there is no reason to bikeshed the name or its contents right now.

TODO:
* add some tests
* think about whether we need a git attribute or not (I did some thinking, and if we do need to configure this at all, this is where I would put it)
* figure out how to make is_emptyline CRLF aware

Changes since my v2:
* fixed is_emptylines in the wrong patch

Changes since my v1:
* rename xdl_hash_and_recmatch to recs_match
* remove counting empty lines in the first section of the looping

Changes since Stefan's v1:
* Added a patch to implement xdl_hash_and_recmatch as Junio suggested.
* Fixed a segfault in Stefan's patch
* Added XDL flag to configure the behavior
* Used an int and counted empty lines via += instead of |=
* Renamed starts_with_emptyline to is_emptyline
* Added diff command line and config options

The interdiff between v2 and v3 is very small:

xdiff/xdiffi.c +1 -0
index 9436ad735243..dd93e6781e8b 100644
@@ -485,6 +485,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 			 * the group.
 			 */
 			while (ix < nrec && recs_match(recs, ixs, ix, flags)) {
+
 				emptylines += is_emptyline(recs[ix]->ptr);
 
 				rchg[ixs++] = 0;

Jacob Keller (1):
xdiff: add recs_match helper function

Stefan Beller (1):
xdiff: implement empty line chunk heuristic

 Documentation/diff-config.txt  |  6 ++++++
 Documentation/diff-options.txt |  6 ++++++
 diff.c                         | 11 +++++++++++
 xdiff/xdiff.h                  |  2 ++
 xdiff/xdiffi.c                 | 41 +++++++++++++++++++++++++++++++++++++----
 5 files changed, 62 insertions(+), 4 deletions(-)
Signature · 1 line
2.8.1.369.geae769a