diff --git a/changelog.html b/changelog.html
index 5ee68ba6fe0224619f88b710ab717c8704c5733b..dd47643a8fb843233e58d605c6c6a69a3068c8bc 100644
--- a/changelog.html
+++ b/changelog.html
@@ -55,6 +55,9 @@ Upcoming changes
+ -
+ Fixed a bad interaction between Windows symlinks and build record lazy loading.
+ (issue 15587)
-
Remember the lastStable/Failed/Successful/etc builds to avoid eager loading builds.
(issue 16089)
diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java
index 241dfa747b5b00f24e90d4355a860be39bce2969..4ab0f00bc2f71e7ac97bcb7b224cf4298c5f27da 100644
--- a/core/src/main/java/hudson/Util.java
+++ b/core/src/main/java/hudson/Util.java
@@ -1140,6 +1140,21 @@ public class Util {
return resolveSymlink(link);
}
+ /**
+ * Resolves a symlink to the {@link File} that points to.
+ *
+ * @return null
+ * if the specified file is not a symlink.
+ */
+ public static File resolveSymlinkToFile(File link) throws InterruptedException, IOException {
+ String target = resolveSymlink(link);
+ if (target==null) return null;
+
+ File f = new File(target);
+ if (f.isAbsolute()) return f; // absolute symlink
+ return new File(link.getParentFile(),target); // relative symlink
+ }
+
/**
* Resolves symlink, if the given file is a symlink. Otherwise return null.
*
diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java
index c0d60b2d193fe259598ff8abb6e8880f75f35b11..29e343c0c032af3c107c04b5bc7048eb61ef1e57 100644
--- a/core/src/main/java/hudson/model/Run.java
+++ b/core/src/main/java/hudson/model/Run.java
@@ -341,6 +341,12 @@ public abstract class Run ,RunT extends Run,RunT extends Run