Skip to content

Latest commit

 

History

History
96 lines (60 loc) · 2.95 KB

README.md

File metadata and controls

96 lines (60 loc) · 2.95 KB

zograscope :: zs-diff

Screenshot

  1. Description
  2. Comparison
  3. Running without integration
  4. Integrating into Git

Description

zs-diff is a terminal-based syntax-aware diff. The syntax-aware part means that comparison isn't sensible to formatting changes and understands general structure of its input.

The primary purpose of the utility is to be used as external diff within git.

Status

Complicated changes of expressions or rewrites of functions might produce results that are hard to understand. Small or medium changes should be mostly handled well.

Documentation

See the manual page for more details.

Comparison

(This section is outdated and needs an update.)

This section presents various kinds of alternative diffs and demonstrates why syntax-aware ones are useful.

The example was crafted to be small, non-trivial (all tools handle trivial changes gracefully) and demonstrate all four kinds of changes (deletion, insertion, update and move). It partially avoids cases which due to current heuristics don't look that nice in zs-diff, but is otherwise objective (those cases are usually less common and aren't actually handled well by other tools either).

git-diff

git-diff

Complete removal and addition isn't bad on its own, but it forces to match lines manually and look for changes in them manually too (diff-highlight script doesn't work in cases like this one).

diff --side-by-side

sdiff

Somewhat more readable version of git-diff even though it lacks highlighting.

cdiff

The alignment is good. Highlighting within lines is somewhat messy.

icdiff

This is quite readable actually, but again character-level diffing is hard to understand.

ydiff

The granularity of detected changes is coarse, but changes can be identified.

gumtree

gumtree

Disregarding unfortunate colors it's possible to see that structural changes were in fact captured albeit not perfectly.

zs-diff

zs-diff

Fine-grained matching would benefit from improvements as well as change detection for more complicated cases in general, but changes that were applied to this piece of code are quite easy to see and reason about.