deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (hnrss.org)

OmniDiff: open-source Rust difftool adds sub-100ms content-aware diffs for Git

OmniDiff, an open-source difftool written in Rust, promises sub-100ms diffs and type-aware handling of code, images, fonts, archives and PDFs, with git, jj and editor integrations.

OmniDiff: open-source Rust difftool adds sub-100ms content-aware diffs for Git

A content-aware difftool written in Rust

OmniDiff, an open-source diff tool written in Rust, reached Hacker News's front page on November 1. According to the project's README on GitHub, it produces diffs in under 100 milliseconds, a figure measured on a ThinkPad T14s with an Intel Core i7-1370P and 32 GB of RAM, and it handles 99.95% of code changes. Instead of treating every file as lines of text, it selects a content-specific algorithm for 98.8% of the changes it processes.

Beyond text diffs

The tool parses files by type and reports what actually changed inside them. The README's accuracy table lists, among other categories, code at 70% perfect and 92% near-perfect accuracy, pictures at 69% and 91%, and fonts at 82% and 100%. PDFs score full marks on both accuracy measures, but the project notes that format has fewer than ten judged test cases, so that number rests on a very small sample. Illustrated examples include a PDF diagram with a single renamed box, a web font with twenty redrawn icons, an OpenDocument file and a compiled translation catalog, with side-by-side comparisons against Unix diff viewable in the browser. Binaries whose type is not supported still get the familiar one-line notice that the file differs, matching what git and diff(1) print.

Installation and packaging

Prebuilt binaries for Linux, macOS on both Intel and Apple Silicon, and Windows accompany every GitHub release. The README also lists Homebrew for macOS and Linux, a signed apt repository for Debian and Ubuntu covering amd64 and arm64, a Nix flake, and packaging recipes for Arch and Gentoo. Building from source with cargo requires rustc 1.92 or later and a C compiler on PATH, because every tree-sitter grammar is compiled from C; the first build takes several minutes, partly due to the fat-LTO release profile.

Git, Jujutsu and editor integration

The core interface is a terminal UI opened by passing two files to the omnidiff command, with 24-bit color when the terminal advertises support. OmniDiff also registers as a git difftool backend through an interactive setup wizard that can configure git globally or per repository, or via two manual git config commands, and it works without any difftool configuration at all through GIT_EXTERNAL_DIFF. One caveat: git diff and git log -p always render in non-interactive text mode because git pipes their output through a pager, so the full-screen viewer requires git difftool. Jujutsu (jj) ignores git's difftool settings and needs its own configuration, and the README stresses that jj's file-by-file invocation mode is mandatory, since OmniDiff diffs pairs of files rather than two directory trees. On the editor side there is a VS Code extension, also published on Open VSX for VSCodium, Cursor and Windsurf, plus a Neovim plugin, although VS Code's API for replacing the built-in diff view is implemented upstream but not yet released.

Headless output and scripting

A --headless flag (synonym --batch) prints plain text, and the tool switches to that mode automatically whenever stdout is not a terminal, so piping into less works without flags. Text output collapses long runs of unchanged lines, keeps three context lines around each change by default (overridable with --context), and labels each hunk with the enclosing function, class or struct when that line would otherwise be off-screen, keeping deep changes locatable in large files. Exit codes follow the diff(1) convention of 0 for success and 2 for error, while --exit-code is an opt-in way to also return 1 when files differ; the README explains that non-zero exits make version control systems assume the tool failed, with jj warning on every file and git difftool able to abort the whole run. A --mode json option emits a diff as a single JSON object documented by a JSON Schema. A companion browser-based code review tool is listed at version 0.0.0, with the README cautioning against relying on it.

Why it matters

Code review lives in diffs, yet the standard toolchain treats images, fonts, archives and documents as opaque blobs. By parsing content by type and describing the actual change, such as a renamed box in a diagram or redrawn icons in a font, OmniDiff can shorten review cycles on repositories that mix code with assets, and its sub-100ms target keeps it viable as an everyday difftool rather than a novelty. The caveats are real: the benchmark numbers are self-reported on one laptop, and the PDF accuracy sample is tiny. But with broad packaging, git and jj integration, JSON output for scripting and editor plugins, this is a practical, installable release rather than a proof of concept.

  • #rust
  • #git
  • #open-source
  • #developer-tools
  • #diff

Related posts