Skip to content

Instantly share code, notes, and snippets.

@apeckham
Last active November 26, 2022 20:20
Show Gist options
  • Save apeckham/bc49e0516c0b9c50158f538d999ccb4d to your computer and use it in GitHub Desktop.
Save apeckham/bc49e0516c0b9c50158f538d999ccb4d to your computer and use it in GitHub Desktop.
list files that tests don't require, one file at a time
#!/bin/env bash
set -uf -o pipefail
if [ -n "$(git status --porcelain)" ]; then
echo "git status is not clean"
exit 1
fi
if [ $# -eq 0 ]; then
echo "usage: $0 command"
exit 1
fi
echo "checking command ..."
if ! time eval "$*"; then
echo "command failed with no file changes"
exit 1
fi
for file in $(git ls-files | shuf | grep -Ev '^test/|^\.git'); do
echo "$file ..."
rm "$file"
if eval "$*"; then
echo "*** $file wasn't necessary"
fi
git checkout "$file" --quiet
done
../deadfiles.sh docker-compose exec -T app lein with-profile +app bat-test | tee ../dead.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment