Allow multiple level sets, pull out default order into "sequence" file

This commit is contained in:
Sebastian Morr 2020-09-22 16:12:03 +02:00
parent a9f096636a
commit 5031009dd5
96 changed files with 37 additions and 29 deletions
levels/bottom-up/puzzle-precious-blob

View file

@ -0,0 +1 @@
Create two trees pointing to the same blob!

View file

@ -0,0 +1,7 @@
BLOB=$(echo "I am precious" | git hash-object -w --stdin)
git update-index --add --cacheinfo 100644,$BLOB,a
git write-tree
git update-index --force-remove a
git update-index --add --cacheinfo 100644,$BLOB,b
git write-tree
git update-index --force-remove b

View file

@ -0,0 +1,10 @@
TREES=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep tree | cut -f1 -d" ")
ALL_TREE_CHILDREN=$(for TREE in $TREES; do
git cat-file -p $TREE | cut -f1 | cut -f3 -d" "
done)
NUMBER_OF_CHILDREN=$(echo "$ALL_TREE_CHILDREN" | wc -l)
UNIQUE_CHILDREN=$(echo "$ALL_TREE_CHILDREN" | sort -u | wc -l)
test "$NUMBER_OF_CHILDREN" -gt "$UNIQUE_CHILDREN"