Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Repository has no commit" error in case of worktree + packed-refs #1290

Open
vikukush opened this issue Oct 2, 2024 · 1 comment
Open

Comments

@vikukush
Copy link

vikukush commented Oct 2, 2024

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

@vikukush
Copy link
Author

vikukush commented Oct 2, 2024

The issue went away after I created the very next commit, which created D:\Platform.git\refs\heads\user\vikukush\mstestv3 file, so the commit ID was no longer inside packed-refs.
So the bug can be easily worked around, but this of course still needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant