From e85766f6714ac998312f5d192347feee3ca50e5c Mon Sep 17 00:00:00 2001 From: david Date: Wed, 17 Apr 2024 19:33:24 +0200 Subject: [PATCH] Add change 22 instructions --- how_to/Change_22.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 how_to/Change_22.md diff --git a/how_to/Change_22.md b/how_to/Change_22.md new file mode 100644 index 0000000..19941a0 --- /dev/null +++ b/how_to/Change_22.md @@ -0,0 +1,28 @@ +- tag: Create the tag ref + +After we've implemented refs in the previous change, it's time to create a ref +when the user creates a tag. + +`create_tag` now calls update_ref with the tag name to actually create the tag. + +For namespacing purposes, we'll put all tags under *refs/tags/*. That is, if the +user creates *my-cool-commit* tag, we'll create *refs/tags/my-cool-commit* ref +to point to the desired OID. + +Then we'll update *data.py* to handle this "namespaced" ref. Since we can't have +a / in the file name, we'll create directories for it. Now if a ref +*refs/tags/sometag* is created, it will be placed under *.ugit/refs/tags* in a +file named *sometag*. + +To verify that this code works, you can run: +``` +$ ugit tag test +``` + +And make sure that the tag points to HEAD: +``` +$ cat .ugit/refs/tags/test +$ cat .ugit/HEAD +``` + +The last two commands should give the same output.