Implement symbolic refs idea

This commit is contained in:
daviddoji committed 2024-06-09 21:20:53 +02:00
1 parent 3770c81942
commit 7a0f86e49b
1 file changed
+7 -1
+7 -1
View File
@@ -20,9 +20,15 @@ def update_ref(ref, oid):
def get_ref(ref):
ref_path = f"{GIT_DIR}/{ref}"
value = None
if Path.is_file(ref_path):
with open(ref_path) as f:
return f.read().strip()
value = f.read().strip()
if value and value.startswith("ref:"):
return get_ref(value.split(":", 1)[1].strip())
return value
def iter_refs():