Cache successful commits
```git-check-assertions run test/git-check-assertions.bats assert_success git checkout HEAD~1 bin run test/git-check-assertions.bats assert_failure assert_output --partial "file exists, but it was expected to be absent" ```
This commit is contained in:
parent
fea90637e3
commit
e647b2599b
4 changed files with 80 additions and 1 deletions
|
|
@ -87,7 +87,22 @@ echo "Base: $base"
|
|||
echo "Commits to visit: ${#commits[@]}"
|
||||
echo
|
||||
|
||||
declare -A cached_commits=()
|
||||
if [ -f .git-check-assertions-cache ]; then
|
||||
while IFS= read -r cached_commit; do
|
||||
if [ -n "$cached_commit" ]; then
|
||||
cached_commits["$cached_commit"]=1
|
||||
fi
|
||||
done < .git-check-assertions-cache
|
||||
fi
|
||||
|
||||
for commit_hash in "${commits[@]}"; do
|
||||
if [ -n "${cached_commits[$commit_hash]+x}" ]; then
|
||||
echo "Skipping $commit_hash (cached)"
|
||||
echo
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "Checking out $commit_hash"
|
||||
git -c advice.detachedHead=false checkout -q "$commit_hash"
|
||||
commit_msg="$(git log -1 --format=%B "$commit_hash")"
|
||||
|
|
@ -107,6 +122,7 @@ for commit_hash in "${commits[@]}"; do
|
|||
fi
|
||||
restore
|
||||
fi
|
||||
printf '%s\n' "$commit_hash" >>.git-check-assertions-cache
|
||||
echo
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue