fix(git): init clone
This commit is contained in:
parent
8d1472b5a7
commit
bbea101acd
|
@ -11,13 +11,15 @@ class GitActions(
|
|||
private val context: Context
|
||||
) {
|
||||
private val cloneFolder = context.filesDir.resolve("popequer")
|
||||
private val myCommitter = "sos" to "example@example.org"
|
||||
private val myCommitter = "Mobile Sandbox" to "example@example.org"
|
||||
private val credentials = UsernamePasswordCredentialsProvider(
|
||||
"popequer-mobile-sandbox",
|
||||
"armament opals stupidest proud classmates"
|
||||
)
|
||||
private val git by lazy {
|
||||
runCatching {
|
||||
private lateinit var git: Git
|
||||
|
||||
fun cloneOrInit() {
|
||||
git = runCatching {
|
||||
Git.open(cloneFolder)
|
||||
}.getOrElse {
|
||||
cloneFolder.deleteRecursively()
|
||||
|
@ -29,8 +31,9 @@ class GitActions(
|
|||
.call()
|
||||
} ?: throw IllegalStateException("Failed to open git repository")
|
||||
}
|
||||
|
||||
fun trigger() {
|
||||
cloneOrInit()
|
||||
|
||||
val hash = System.currentTimeMillis().hashCode().absoluteValue.toString(16)
|
||||
val myFile = cloneFolder.resolve("my_file_$hash.txt").also {
|
||||
it.writeText("$hash ! ")
|
||||
|
|
Loading…
Reference in a new issue