Skip to content

Instantly share code, notes, and snippets.

@tjanez
Last active May 2, 2020 11:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjanez/db53b28926cfe262d428 to your computer and use it in GitHub Desktop.
Save tjanez/db53b28926cfe262d428 to your computer and use it in GitHub Desktop.
Script to test reproducibility of git-archive-all.sh and git's built-in archive command
#!/bin/bash
# Script to test reproducibility of git-archive-all.sh and git's built-in
# archive command
#
# Usage:
# 1. Copy the script to your git directory with submodules.
# 2. Download the git-archive-all.sh script:
# https://raw.githubusercontent.com/meitar/git-archive-all.sh/master/git-archive-all.sh
# and place it somewhere in your $PATH and make it executable.
# 3. Run the script.
#
# Note: The git's built-in archive command doesn't archive the submodules, it
# is only used here to show it is reproducible.
#
# Author: Tadej Janež <tadej.j@nez.si>
#
# License: GPLv3+
TMPDIR=$(mktemp -d /tmp/reproducibility_test.XXXXXX)
for i in {1..3}; do
git-archive-all.sh --format tar --tree-ish HEAD $TMPDIR/git-archive-all-tar_only-$i.tar
git-archive-all.sh --format tar.gz --tree-ish HEAD $TMPDIR/git-archive-all-tar_with_gzip-$i.tar.gz
git-archive-all.sh --format zip --tree-ish HEAD $TMPDIR/git-archive-all-zip-$i.zip
git archive --format=tar --output $TMPDIR/git-archive-tar_only-$i.tar HEAD
git archive --format=tar.gz --output $TMPDIR/git-archive-tar_with_gzip-$i.tar.gz HEAD
git archive --format=zip --output $TMPDIR/git-archive-zip-$i.zip HEAD
done
pushd $TMPDIR
md5sum *
popd
rm -r $TMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment