mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-01 20:42:01 +02:00
Convert "internal" levels to new level format
This commit is contained in:
parent
613b1b9852
commit
53a6885ef9
108 changed files with 727 additions and 382 deletions
levels/internals
41
levels/internals/ref-move
Normal file
41
levels/internals/ref-move
Normal file
|
@ -0,0 +1,41 @@
|
|||
[description]
|
||||
|
||||
You can point refs to a new location using the same command you use to create them:
|
||||
|
||||
git update-ref refs/<refname> <object>
|
||||
|
||||
As an exercise, make all refs in this repository point to the tree object!
|
||||
|
||||
[setup]
|
||||
|
||||
echo hello > hello
|
||||
echo world > world
|
||||
BLOB1=$(git hash-object -w hello)
|
||||
BLOB2=$(git hash-object -w world)
|
||||
git add .
|
||||
TREE=$(git write-tree)
|
||||
COMMIT=$(git commit-tree $TREE -m "Initial commit")
|
||||
|
||||
git update-ref refs/a "$BLOB1"
|
||||
git update-ref refs/b "$COMMIT"
|
||||
|
||||
[setup goal]
|
||||
|
||||
echo hello > hello
|
||||
echo world > world
|
||||
BLOB1=$(git hash-object -w hello)
|
||||
BLOB2=$(git hash-object -w world)
|
||||
git add .
|
||||
TREE=$(git write-tree)
|
||||
COMMIT=$(git commit-tree $TREE -m "Initial commit")
|
||||
|
||||
git update-ref refs/a "$BLOB1"
|
||||
git update-ref refs/b "$COMMIT"
|
||||
|
||||
for REF in $(git for-each-ref --format='%(refname)'); do
|
||||
git update-ref "$REF" "$TREE"
|
||||
done
|
||||
|
||||
[win]
|
||||
|
||||
test "$(git show-ref -s | sort -u)" = "c7863f72467ed8dd44f4b8ffdb8b57ca7d91dc9e"
|
|
@ -1,5 +0,0 @@
|
|||
You can point refs to a new location using the same command you use to create them:
|
||||
|
||||
git update-ref refs/<refname> <object>
|
||||
|
||||
As an exercise, make all refs in this repository point to the tree object!
|
|
@ -1,3 +0,0 @@
|
|||
for REF in $(git for-each-ref --format='%(refname)'); do
|
||||
git update-ref "$REF" "$TREE"
|
||||
done
|
|
@ -1,10 +0,0 @@
|
|||
echo hello > hello
|
||||
echo world > world
|
||||
BLOB1=$(git hash-object -w hello)
|
||||
BLOB2=$(git hash-object -w world)
|
||||
git add .
|
||||
TREE=$(git write-tree)
|
||||
COMMIT=$(git commit-tree $TREE -m "Initial commit")
|
||||
|
||||
git update-ref refs/a "$BLOB1"
|
||||
git update-ref refs/b "$COMMIT"
|
|
@ -1 +0,0 @@
|
|||
test "$(git show-ref -s | sort -u)" = "c7863f72467ed8dd44f4b8ffdb8b57ca7d91dc9e"
|
Loading…
Add table
Add a link
Reference in a new issue