mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-23 13:26:02 +00:00
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
This commit is contained in:
parent
422422a2bc
commit
48e5eece1e
@ -268,10 +268,10 @@ public class GlobalBuildInfoPlugin implements Plugin<Project> {
|
|||||||
Path refFile = gitDir.resolve(refName);
|
Path refFile = gitDir.resolve(refName);
|
||||||
if (Files.exists(refFile)) {
|
if (Files.exists(refFile)) {
|
||||||
revision = readFirstLine(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
|
// Check packed references for commit ID
|
||||||
Pattern p = Pattern.compile("^([a-f0-9]{40}) " + refName + "$");
|
Pattern p = Pattern.compile("^([a-f0-9]{40}) " + refName + "$");
|
||||||
try (Stream<String> lines = Files.lines(dotGit.resolve("packed-refs"))) {
|
try (Stream<String> lines = Files.lines(gitDir.resolve("packed-refs"))) {
|
||||||
revision = lines.map(p::matcher)
|
revision = lines.map(p::matcher)
|
||||||
.filter(Matcher::matches)
|
.filter(Matcher::matches)
|
||||||
.map(m -> m.group(1))
|
.map(m -> m.group(1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user