diff --git a/convention/src/main/kotlin/io/gitlab/jfronny/scripts/Environment.kt b/convention/src/main/kotlin/io/gitlab/jfronny/scripts/Environment.kt deleted file mode 100644 index 2e18cf6..0000000 --- a/convention/src/main/kotlin/io/gitlab/jfronny/scripts/Environment.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.gitlab.jfronny.scripts - -import java.lang.reflect.Field -import java.util.* - -private val processEnvironmentClass: Class<*> = Class.forName("java.lang.ProcessEnvironment") -private val theEnvironmentField: Field = processEnvironmentClass.getDeclaredField("theEnvironment").apply { isAccessible = true } -private val theCaseInsensitiveEnvironmentField: Field = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment").apply { isAccessible = true } - -@Throws(Exception::class) -fun setEnv(newenv: Map?) = try { - val env = theEnvironmentField.get(null) as MutableMap - env.clear() - env.putAll(newenv!!) - val cienv = theCaseInsensitiveEnvironmentField.get(null) as MutableMap - cienv.clear() - cienv.putAll(newenv) -} catch (e: NoSuchFieldException) { - val classes = Collections::class.java.declaredClasses - val env = System.getenv() - for (cl in classes) { - if ("java.util.Collections\$UnmodifiableMap" == cl.name) { - val field: Field = cl.getDeclaredField("m").apply { isAccessible = true } - val map = field.get(env) as MutableMap - map.clear() - map.putAll(newenv!!) - } - } -} diff --git a/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt b/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt index 3806610..7b74efd 100644 --- a/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt +++ b/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt @@ -25,14 +25,7 @@ fun initializeGit() { override fun getCurrentTime(): Long = original.currentTime override fun getTimezone(`when`: Long): Int = original.getTimezone(`when`) }) - // Stuff -// val backup = HashMap(System.getenv()) -// setEnv(mapOf()) -// try { - org.eclipse.jgit.util.FS.DETECTED.gitSystemConfig -// } finally { -// setEnv(backup) -// } + FS.DETECTED.gitSystemConfig } fun Git.log(since: AnyObjectId? = null, until: AnyObjectId? = null): List {