Skip to content

Commit

Permalink
Fix git info within VM for worktrees (#51119)
Browse files Browse the repository at this point in the history
If a worktree is used, say for 7.x, and packaging tests are run, the
build within the VM will fail due to the parent checkout not being
accessible. This is because the path of the worktree is for the host
systtem, not the VM. This commit makes the git info unknown, just as if
the .git directory did not exist.
  • Loading branch information
rjernst committed Jan 25, 2020
1 parent 3e3673b commit 87b926a
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ public static String gitRevision(File rootDir) {
} else {
// this is a git worktree, follow the pointer to the repository
final Path workTree = Paths.get(readFirstLine(dotGit).substring("gitdir:".length()).trim());
if (Files.exists(workTree) == false) {
return "unknown";
}
head = workTree.resolve("HEAD");
final Path commonDir = Paths.get(readFirstLine(workTree.resolve("commondir")));
if (commonDir.isAbsolute()) {
Expand Down

0 comments on commit 87b926a

Please sign in to comment.