After git decided to pack my repo with several worktrees and a bunch of local branches, my builds started failing with following error:
D:\Corextroot\microsoft.build.tasks.git\8.0.0\build\Microsoft.Build.Tasks.Git.targets(25,5): Repository has no commit. [D:\Pl3\Test\UnitTests\Common\Tools.UnitTests.Common\Tools.UT.Common.csproj]
- D:\Pl3 is a worktree of D:\Platform.
 
- D:\Platform\.git\worktrees\Pl3\refs is empty.
 
- D:\Platform\.git\refs\heads doesn't have a ref of a branch that's checked out in D:\Pl3 either
 
- The only reference to the commit ID of a branch specified in D:\Platform\.git\worktrees\Pl3\HEAD is in D:\Platform\.git\packed-refs
 
Sourcelink task is unable to handle this situation.
I have worked to add a unit test that covers my scenario: #1289