Rework levels, and add some new ones

This commit is contained in:
Sebastian Morr 2020-09-15 22:35:14 +02:00
parent 931e9b3beb
commit 35b4dc098a
47 changed files with 163 additions and 39 deletions
levels/symref-no-deref

View file

@ -0,0 +1,7 @@
When you have a symbolic ref (a ref pointing at another ref), and you decide you want it to be a regular ref again (pointing to an object), you're in for some trouble! :)
What happens when you try pointing the symbolic ref directly to the blob using `git update-ref`?
Oops! Turns out that when you reference a symbolic ref, it acts as if you had specified the ref it points to. To de-symbolic-ize it, use the `--no-deref` option directly after `update-ref`!
Weird, huh?

View file

@ -0,0 +1 @@
git update-ref --no-deref refs/fries "$BLOB2"

View file

@ -0,0 +1,4 @@
BLOB1=$(echo delicious | git hash-object -w --stdin)
BLOB2=$(echo very | git hash-object -w --stdin)
git update-ref refs/curly "$BLOB1"
git symbolic-ref refs/fries refs/curly

View file

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