Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (21 sloc) 607 Bytes
#!/bin/sh
# Run a command over a sequence of commits.
# Example:
# git test-once 'make clean && make compile && make test'
. "$(git --exec-path)/git-sh-setup"
require_work_tree
get_hash_input() {
echo "$1"
git rev-parse 'HEAD^{tree}'
git diff HEAD
}
already_passed() {
h=`get_hash_input "$1" | git hash-object --stdin`
git cat-file blob $h > /dev/null 2>/dev/null && echo "Already passed $h"
}
passed_on() {
h=`get_hash_input "$1" | git hash-object -w --stdin`
echo "Passed: $h."
}
echo "Testing $1"
already_passed "$1" || ( eval "$1" && passed_on "$1" ) || passed_on "$1"