Create the tag ref
This commit is contained in:
@@ -11,13 +11,16 @@ def init():
|
||||
|
||||
|
||||
def update_ref(ref, oid):
|
||||
with open(f"{GIT_DIR}/{ref}", "w") as f:
|
||||
ref_path = f"{GIT_DIR}/{ref}"
|
||||
Path.mkdir(ref_path, exist_ok=True)
|
||||
with open(ref_path, "w") as f:
|
||||
f.write(oid)
|
||||
|
||||
|
||||
def get_ref(ref):
|
||||
if Path.is_file(f"{GIT_DIR}/{ref}"):
|
||||
with open(f"{GIT_DIR}/HEAD") as f:
|
||||
ref_path = f"{GIT_DIR}/{ref}"
|
||||
if Path.is_file(ref_path):
|
||||
with open(ref_path) as f:
|
||||
return f.read().strip()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user