Skip to content

Commit

Permalink
Merge pull request #193 from MarkEWaite/master-JENKINS-30371-jgit-sym…
Browse files Browse the repository at this point in the history
…links

[Fix JENKINS-30371] allow symlinks with jgit
  • Loading branch information
MarkEWaite committed Nov 23, 2015
2 parents 11d9be2 + 73e053c commit d489829
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
22 changes: 22 additions & 0 deletions pom.xml
Expand Up @@ -94,6 +94,14 @@
<artifactId>org.eclipse.jgit.http.server</artifactId>
<version>${jgit.version}</version>
</dependency>
<dependency>
<!-- Include jgit java7 component so that jgit can support
symbolic links when running on Java 7 with a file system
which supports symbolic links. See JENKINS-30371 -->
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.java7</artifactId>
<version>${jgit.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -209,6 +217,7 @@
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs-maven-plugin.version}</version>
<configuration>
<skip>${skipFindbugs}</skip>
<excludeFilterFile>src/findbugs/excludesFilter.xml</excludeFilterFile>
<failOnError>${maven.findbugs.failure.strict}</failOnError>
<xmlOutput>true</xmlOutput>
Expand All @@ -226,4 +235,17 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>java-6</id>
<activation>
<jdk>1.6</jdk>
</activation>
<properties>
<!-- Findbugs requires Java 7. This allows default run
of findbugs on every compile, unless running Java 6 -->
<skipFindbugs>true</skipFindbugs>
</properties>
</profile>
</profiles>
</project>
Expand Up @@ -2044,13 +2044,20 @@ public void test_hasSubmodules() throws Exception {
assertFalse(w.git.hasGitModules());
}

private boolean isJava6() {
if (System.getProperty("java.version").startsWith("1.6")) {
return true;
}
return false;
}

/**
* core.symlinks is set to false by msysgit on Windows and by JGit
* 3.3.0 on all platforms. It is not set on Linux. Refer to
* JENKINS-21168, JENKINS-22376, and JENKINS-22391 for details.
*/
private void checkSymlinkSetting(WorkingArea area) throws IOException {
String expected = SystemUtils.IS_OS_WINDOWS || area.git instanceof JGitAPIImpl ? "false" : "";
String expected = SystemUtils.IS_OS_WINDOWS || (area.git instanceof JGitAPIImpl && isJava6()) ? "false" : "";
String symlinkValue = null;
try {
symlinkValue = w.cmd(true, "git config core.symlinks").trim();
Expand Down

0 comments on commit d489829

Please sign in to comment.