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 746a06374ace0..7c3c4ab8e8083 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java @@ -271,10 +271,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))