Generalize HEAD to refs
This commit is contained in:
@@ -10,13 +10,13 @@ def init():
|
||||
Path.mkdir(f"{GIT_DIR}/objects")
|
||||
|
||||
|
||||
def set_HEAD(oid):
|
||||
with open(f"{GIT_DIR}/HEAD", "w") as f:
|
||||
def update_ref(ref, oid):
|
||||
with open(f"{GIT_DIR}/{ref}", "w") as f:
|
||||
f.write(oid)
|
||||
|
||||
|
||||
def get_HEAD():
|
||||
if Path.is_file(f"{GIT_DIR}/HEAD"):
|
||||
def get_ref(ref):
|
||||
if Path.is_file(f"{GIT_DIR}/{ref}"):
|
||||
with open(f"{GIT_DIR}/HEAD") as f:
|
||||
return f.read().strip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user