mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-01 20:42:01 +02:00
Allow multiple level sets, pull out default order into "sequence" file
This commit is contained in:
parent
a9f096636a
commit
5031009dd5
96 changed files with 37 additions and 29 deletions
levels/bottom-up/commit-rhombus
5
levels/bottom-up/commit-rhombus/description
Normal file
5
levels/bottom-up/commit-rhombus/description
Normal file
|
@ -0,0 +1,5 @@
|
|||
A commit can have multiple parents! You can specify the -p option multiple times, like this:
|
||||
|
||||
git commit-tree <tree> -m "Description" -p <parent1> -p <parent2>
|
||||
|
||||
Build a rhombus shape from commits, where two commits point to the same parent, and then a fourth commit points to both of them.
|
5
levels/bottom-up/commit-rhombus/goal
Normal file
5
levels/bottom-up/commit-rhombus/goal
Normal file
|
@ -0,0 +1,5 @@
|
|||
TREE=$(git write-tree)
|
||||
SOUTH=$(git commit-tree $TREE -m "South")
|
||||
EAST=$(git commit-tree $TREE -m "East" -p $SOUTH)
|
||||
WEST=$(git commit-tree $TREE -m "West" -p $SOUTH)
|
||||
NORTH=$(git commit-tree $TREE -m "Nort" -p $EAST -p $WEST)
|
0
levels/bottom-up/commit-rhombus/start
Normal file
0
levels/bottom-up/commit-rhombus/start
Normal file
10
levels/bottom-up/commit-rhombus/win
Normal file
10
levels/bottom-up/commit-rhombus/win
Normal file
|
@ -0,0 +1,10 @@
|
|||
COMMITS=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep commit | cut -f1 -d" ")
|
||||
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
||||
exit 1
|
Loading…
Add table
Add a link
Reference in a new issue