chore(autoversion): clean up leftovers from previous approach
This commit is contained in:
parent
8decdad746
commit
d095a18b2b
@ -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<String, String>?) = try {
|
|
||||||
val env = theEnvironmentField.get(null) as MutableMap<String, String>
|
|
||||||
env.clear()
|
|
||||||
env.putAll(newenv!!)
|
|
||||||
val cienv = theCaseInsensitiveEnvironmentField.get(null) as MutableMap<String, String>
|
|
||||||
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<String, String>
|
|
||||||
map.clear()
|
|
||||||
map.putAll(newenv!!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,14 +25,7 @@ fun initializeGit() {
|
|||||||
override fun getCurrentTime(): Long = original.currentTime
|
override fun getCurrentTime(): Long = original.currentTime
|
||||||
override fun getTimezone(`when`: Long): Int = original.getTimezone(`when`)
|
override fun getTimezone(`when`: Long): Int = original.getTimezone(`when`)
|
||||||
})
|
})
|
||||||
// Stuff
|
FS.DETECTED.gitSystemConfig
|
||||||
// val backup = HashMap(System.getenv())
|
|
||||||
// setEnv(mapOf())
|
|
||||||
// try {
|
|
||||||
org.eclipse.jgit.util.FS.DETECTED.gitSystemConfig
|
|
||||||
// } finally {
|
|
||||||
// setEnv(backup)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Git.log(since: AnyObjectId? = null, until: AnyObjectId? = null): List<Commit> {
|
fun Git.log(since: AnyObjectId? = null, until: AnyObjectId? = null): List<Commit> {
|
||||||
|
Loading…
Reference in New Issue
Block a user