Created
April 7, 2020 20:49
-
-
Save erikarvstedt/5b0b1a7787ebc1342fcc3f237da5afa7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
instantiateTest() { | |
test/run-tests.sh vmTestNixExpr | nix-instantiate --indirect --add-root $1 - > /dev/null | |
} | |
TMPDIR=/tmp/diff-vm-drv | |
mkdir -p $TMPDIR | |
if [[ ! -e $TMPDIR/master ]]; then | |
echo "Creating test drv for master" | |
if ! git diff-index --quiet HEAD --; then | |
echo "There are uncommitted changes. Exiting." | |
exit 1 | |
fi | |
currentBranch=$(git rev-parse --abbrev-ref HEAD) | |
git checkout master | |
instantiateTest $TMPDIR/master | |
git checkout $currentBranch | |
fi | |
diffTestDrv() { | |
instantiateTest $TMPDIR/current | |
if cmp $TMPDIR/master $TMPDIR/current; then | |
echo "No changes" | |
else | |
nix-diff $TMPDIR/master $TMPDIR/current | |
fi | |
} | |
diffTestDrv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment