From 47d7f467d9a8c28fb234db8af90bb342d3a15e6c Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Fri, 11 Jun 2021 11:02:15 +0200 Subject: [PATCH] Fix resolving HEAD reference if it's a packed ref --- src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs b/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs index 40cfc644..1d3b78b2 100644 --- a/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs +++ b/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs @@ -616,7 +616,9 @@ private GitObjectId ResolveReference(object reference) { if (!FileHelpers.TryOpen(Path.Combine(this.CommonDirectory, (string)reference), out FileStream? stream)) { - return GitObjectId.Empty; + // HEAD can point to a reference that's in the packed references and needs + // a full resolution. + return Lookup((string)reference) ?? GitObjectId.Empty; } using (stream)