Skip to content

Commit ab6a5a4

Browse files
If the lookup doesn't work, attempt to reference the commit as a tag.
1 parent c3ecf1d commit ab6a5a4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Adapters/LibGit2SharpRepository.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,15 @@ public IEnumerable<GitCommit> GetCommitsReachableFromButNotFrom(string includeRe
243243
try
244244
{
245245
var commit = _repository.Lookup<Commit>(reference);
246-
if (commit == null) return null;
246+
if (commit == null)
247+
{
248+
var tag = GetTag(reference);
249+
if (tag == null || String.IsNullOrWhiteSpace(tag.TargetCommitSha))
250+
{
251+
return null;
252+
}
253+
commit = _repository.Lookup<Commit>(tag.TargetCommitSha);
254+
}
247255

248256
var tree = commit.Tree;
249257
var treeEntry = tree[filePath];

0 commit comments

Comments
 (0)