Add change 22 instructions
This commit is contained in:
28
how_to/Change_22.md
Normal file
28
how_to/Change_22.md
Normal file
@@ -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.
|
||||||
Reference in New Issue
Block a user