From 48e5eece1e7343efe3073aafe234b408262ea759 Mon Sep 17 00:00:00 2001 From: Henning Andersen <33268011+henningandersen@users.noreply.github.com> Date: Fri, 10 Jan 2020 13:54:32 +0100 Subject: [PATCH] GlobalBuildInfo support packed-refs with work-tree (#50791) The packed-refs support was using the original .git path, changed to use the real .git directory after reference from worktree has been followed. Relates #47464 --- .../org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java index 4e9e67fb1e8ef..87a226f27bf9c 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java @@ -268,10 +268,10 @@ public static String gitRevision(File rootDir) { Path refFile = gitDir.resolve(refName); if (Files.exists(refFile)) { revision = readFirstLine(refFile); - } else if (Files.exists(dotGit.resolve("packed-refs"))) { + } else if (Files.exists(gitDir.resolve("packed-refs"))) { // Check packed references for commit ID Pattern p = Pattern.compile("^([a-f0-9]{40}) " + refName + "$"); - try (Stream lines = Files.lines(dotGit.resolve("packed-refs"))) { + try (Stream lines = Files.lines(gitDir.resolve("packed-refs"))) { revision = lines.map(p::matcher) .filter(Matcher::matches) .map(m -> m.group(1))