diff options
author | md_5 <git@md-5.net> | 2015-09-02 07:32:27 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-09-02 07:32:27 +1000 |
commit | 190add075270a1b390c309a3142ec57c3d62336c (patch) | |
tree | 0be0bec1347762090e2cbead8ac98dea3e0244a5 /src | |
parent | 7750a2f992e3b85c2b3c26c5e6aaf69f3901cb89 (diff) | |
download | buildtools-190add075270a1b390c309a3142ec57c3d62336c.tar buildtools-190add075270a1b390c309a3142ec57c3d62336c.tar.gz buildtools-190add075270a1b390c309a3142ec57c3d62336c.tar.lz buildtools-190add075270a1b390c309a3142ec57c3d62336c.tar.xz buildtools-190add075270a1b390c309a3142ec57c3d62336c.zip |
Set a sane autocrlf value on fresh clones.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/spigotmc/builder/Builder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 1ea7a4f..ebc7d86 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -58,6 +58,7 @@ import org.apache.commons.io.output.TeeOutputStream; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ResetCommand; import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.revwalk.RevCommit; public class Builder @@ -66,6 +67,7 @@ public class Builder public static final String LOG_FILE = "BuildTools.log.txt"; public static final boolean IS_WINDOWS = System.getProperty( "os.name" ).startsWith( "Windows" ); public static final File CWD = new File( "." ); + private static final boolean autocrlf = !"\n".equals( System.getProperty( "line.separator" ) ); private static boolean dontUpdate; private static boolean skipCompile; private static boolean generateSource; @@ -610,7 +612,7 @@ public class Builder } } - public static void clone(String url, File target) throws GitAPIException + public static void clone(String url, File target) throws GitAPIException, IOException { System.out.println( "Starting clone of " + url + " to " + target ); @@ -618,8 +620,11 @@ public class Builder try { - System.out.println( "Cloned git repository " + url + " to " + target.getAbsolutePath() + ". Current HEAD: " + commitHash( result ) ); + StoredConfig config = result.getRepository().getConfig(); + config.setBoolean( "core", null, "autocrlf", autocrlf ); + config.save(); + System.out.println( "Cloned git repository " + url + " to " + target.getAbsolutePath() + ". Current HEAD: " + commitHash( result ) ); } finally { result.close(); |