Refactor Level class so that we don't need to copy shell scripts

This commit is contained in:
Sebastian Morr 2020-09-29 20:36:57 +02:00
parent 3291f0a78b
commit c178a5c63e
6 changed files with 14 additions and 26 deletions
levels/bottom-up
commit-parents
commit-rhombus
puzzle-trees-all-the-way-down
symref-no-deref
tree-nested

View file

@ -3,8 +3,8 @@ COMMITS=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-o
for COMMIT in $COMMITS; do
echo a commit named $COMMIT
if [ $(git rev-list $COMMIT | wc -l) -ge 3 ]; then
exit 0
return 0
fi
done
exit 1
return 1

View file

@ -3,8 +3,8 @@ COMMITS=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-o
for COMMIT in $COMMITS; do
# My first parent's parents has to be the same as my second parent's parent.
if [ "$(git rev-parse --verify -q $COMMIT^1^)" = "$(git rev-parse --verify -q $COMMIT^2^)" ]; then
exit 0
return 0
fi
done
exit 1
return 1

View file

@ -8,11 +8,11 @@ for TREE in $TREES; do
if [ "$(git cat-file -p $TREE2 | wc -l)" -eq 1 ]; then
if [ "$(git cat-file -p $TREE2 | cut -f1 | grep tree | wc -l)" -eq 1 ]; then
# Same for its child! \o/
exit 0
return 0
fi
fi
fi
fi
done
exit 1
return 1

View file

@ -1,2 +1,2 @@
git symbolic-ref refs/fries && exit 1
git symbolic-ref refs/fries && return 1
test "$(git show-ref -s refs/fries)" = "035e2968dafeea08e46e8fe6743cb8123e8b9aa6"

View file

@ -8,9 +8,9 @@ for OUTER_TREE in $TREES; do
TREE_CHILD=$(git cat-file -p $OUTER_TREE | cut -f1 | grep tree | cut -d" " -f3)
NUMBER_OF_BLOB_CHILDREN_OF_TREE_CHILD=$(git cat-file -p $TREE_CHILD | cut -f2 -d" " | grep blob | wc -l)
if [ $NUMBER_OF_BLOB_CHILDREN_OF_TREE_CHILD -eq 2 ]; then
exit 0
return 0
fi
fi
done
exit 1
return 1