843 B
843 B
- base: Try different directories when searching for a ref
In the previous change, you might have noticed that we need to spell
out the full name of a tag (Like refs/tags/mytag). This isn’t
very convenient, we would like to have shorter command names. For
example, if we’ve created “mytag” tag, we should be able to do
ugit log mytag rather than having to specify
ugit log refs/tags/mytag.
We’ll extend get_oid to search in different ref
subdirectories when resolving a name. We’ll search in:
Root (.ugit): This way we can specify refs/tags/mytag
.ugit/refs: This way we can specify tags/mytag
.ugit/refs/tags: This way we can specify mytag
.ugit/refs/heads: This will be needed for a future change
If we find the requested name in any of the directories, return it. Otherwise assume that the name is an OID.