Don't always derefence ref
This commit is contained in:
parent
fe5ed910a3
commit
c484b41a89
@ -161,7 +161,7 @@ def get_oid(name):
|
||||
f"refs/heads/{name}",
|
||||
]
|
||||
for ref in refs_to_try:
|
||||
if data.get_ref(ref).value:
|
||||
if data.get_ref(ref, deref=False).value:
|
||||
return data.get_ref(ref).value
|
||||
|
||||
# Name is SHA1
|
||||
|
@ -121,10 +121,11 @@ def k(args):
|
||||
dot = "digraph commits {\n"
|
||||
|
||||
oids = set()
|
||||
for refname, ref in data.iter_refs():
|
||||
for refname, ref in data.iter_refs(deref=False):
|
||||
dot += f"'{refname}' [shape=note]\n"
|
||||
dot += f"'{refname}' -> '{ref.value}'\n"
|
||||
oids.add(ref.value)
|
||||
if not ref.symbolic:
|
||||
oids.add(ref.value)
|
||||
|
||||
for oid in base.iter_commits_and_parents(oids):
|
||||
commit = base.get_commit(oid)
|
||||
|
@ -16,9 +16,9 @@ def init():
|
||||
RefValue = namedtuple("RefValue", ["symbolic", "value"])
|
||||
|
||||
|
||||
def update_ref(ref, value):
|
||||
def update_ref(ref, value, deref=True):
|
||||
assert not value.symbolic
|
||||
ref = _get_ref_internal(ref)[0]
|
||||
ref = _get_ref_internal(ref, deref)[0]
|
||||
ref_path = f"{GIT_DIR}/{ref}"
|
||||
Path.mkdir(ref_path, exist_ok=True)
|
||||
with open(ref_path, "w") as f:
|
||||
|
Loading…
Reference in New Issue
Block a user