thblt / write-yourself-a-git

Learn Git by reimplementing it from scratch

Home Page:https://wyag.thb.lt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to add support to branches/tags to object_resolve

cameronsstone opened this issue · comments

Add code like this just before return candidates:

    # search for branches and tags (with or without "refs" and "heads" or "tags" prefixes)
    for path in [f'refs/heads/{name}', f'refs/tags/{name}', f'refs/{name}', name]:
        if os.path.exists(repo_file(repo, path)):
            candidates.append(ref_resolve(repo, path))

Thanks!