No description
  • Go 88.2%
  • Shell 10.4%
  • Makefile 1.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
djach7 310a9bbabb
Merge pull request #101 from rosygmiki/windows-system-test
chore: updates CI runners and handles failing Windows test
2026-06-16 08:54:01 -04:00
.github test: temporarily skip failing missing source file test on Windows 2026-06-15 14:46:29 -04:00
cmd Various features I need for bootc-delta (#75) 2026-04-15 08:38:52 -04:00
pkg test: temporarily skip failing missing source file test on Windows 2026-06-15 14:46:29 -04:00
tests test: temporarily skip failing missing source file test on Windows 2026-06-15 14:46:29 -04:00
.gitignore test: system tests for Fedora Compatibility (#81) 2026-04-22 13:59:20 -04:00
.golangci.yml feat: add comprehensive golangci-lint configuration for enhanced code quality 2026-03-12 09:47:56 -04:00
.goreleaser.yml feat: Add GitHub Actions workflow for automated releases 2026-03-30 12:08:23 -04:00
.releaserc.yml fix: remove '@semantic-release/exec plugin' (avoids extra npm install) 2026-04-06 10:59:38 -04:00
AGENTS.md docs: adds AGENTS.md to guide coding agents 2026-05-20 10:34:10 -04:00
CODE-OF-CONDUCT.md Add Code of Conduct and Security Policies 2020-05-11 14:45:03 +02:00
CONTRIBUTING.md docs: add CONTRIBUTING.md as a best-practices reference for contributors (#92) 2026-05-11 20:42:54 +02:00
file-format.md Add file-format.md 2020-05-11 14:57:32 +02:00
go.mod chore: updates CI to only necessary platforms, and removes patch version for broader compatibility 2026-06-12 10:45:51 -04:00
go.sum deps: bump github.com/klauspost/compress from 1.18.5 to 1.18.6 2026-05-01 19:47:31 +00:00
LICENSE Add LICENSE 2020-04-27 12:44:13 +02:00
Makefile test: system tests for Fedora Compatibility (#81) 2026-04-22 13:59:20 -04:00
README.md chore: updates CI to only necessary platforms, and removes patch version for broader compatibility 2026-06-12 10:45:51 -04:00
SECURITY.md Add Code of Conduct and Security Policies 2020-05-11 14:45:03 +02:00

CI Go Version License codecov

tar-diff

tar-diff is a golang library and set of commandline tools to diff and patch tar files.

pkg/tar-diff and the tar-diff tool take one or more old tar files (optionally compressed) and a new tar file to generate a single file representing the delta between them (a tardiff file).

pkg/tar-patch takes a tardiff file and the uncompressed contents (such as an extracted directory) of the old tar file(s) and reconstructs (binary identically) the new tar file (uncompressed).

Example

$ tar-diff old.tar.gz new.tar.gz delta.tardiff
$ tar xf old.tar.gz -C extracted/
$ tar-patch delta.tardiff extracted/ reconstructed.tar
$ zcat new.tar.gz | shasum
$ shasum reconstructed.tar

Multi-file example

It is sometimes useful to have multiple sources for delta information, such as for example when the sources are container image layers. In this case, you need to provide the old tar files in the order they will be extracted when applying:

$ tar-diff layer1.tar layer2.tar layer3.tar new-layer.tar delta.tardiff
$ tar xf layer1.tar -C extracted/
$ tar xf layer2.tar -C extracted/
$ tar xf layer3.tar -C extracted/
$ tar-patch delta.tardiff extracted/ reconstructed.tar

This handles the case where a file in a later tar file overwrites another.

Partial extraction with prefix filtering

If you only plan to extract certain directories from the old tar files on the target system, you can use --source-prefix to restrict which files can be used as delta sources:

$ tar-diff --source-prefix=blobs/ --source-prefix=config/ old.tar new.tar delta.tardiff
$ tar xf old.tar blobs/ config/ -C extracted/
$ tar-patch delta.tardiff extracted/ reconstructed.tar

This ensures the delta only references files that will be available in the extracted directory.

This is particularly useful for bootc images, for example, where only the files in the ostree repository will be available on the system. In that case you would run tar-diff with --source-prefix=sysroot/ostree/repo/objects/.

Build requirements

  • golang >= 1.26 (see go.mod)
  • make
  • tar
  • diffutils, bzip2, gzip (for tests)

Runtime dependencies

None. The built binaries are self-contained.

The main use case for tar-diff is for more efficient distribution of OCI images. These images are typically transferred as compressed tar files, but the content is referred to and validated by the checksum of the uncompressed content. This makes it possible to use an extracted earlier version of an image in combination with a tardiff file to reconstruct and validate the current version of the image.

Delta compression is based on bsdiff and zstd compression.

The tar-diff file format is described in file-format.md.

Contributing to tar-diff

Interested in collaborating on tar-diff? Check out our CONTRIBUTING.md guide to help get you started!

License

tar-diff is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.