diff --git a/tools/git-adapter/src/commonMain/kotlin/com/zegreatrob/tools/adapter/git/GitAdapter.kt b/tools/git-adapter/src/commonMain/kotlin/com/zegreatrob/tools/adapter/git/GitAdapter.kt index 8328246..1b8c1b9 100644 --- a/tools/git-adapter/src/commonMain/kotlin/com/zegreatrob/tools/adapter/git/GitAdapter.kt +++ b/tools/git-adapter/src/commonMain/kotlin/com/zegreatrob/tools/adapter/git/GitAdapter.kt @@ -191,6 +191,10 @@ class GitAdapter(private val workingDirectory: String) { workingDirectory = workingDirectory, ) } + + fun addRemote(name: String, url: String) { + runProcess(listOf("git", "remote", "add", name, url), workingDirectory) + } } data class GitStatus( diff --git a/tools/git-test/src/jvmMain/kotlin/com/zegreatrob/tools/test/git/GitHelper.kt b/tools/git-test/src/jvmMain/kotlin/com/zegreatrob/tools/test/git/GitHelper.kt index 483f22f..937dfde 100644 --- a/tools/git-test/src/jvmMain/kotlin/com/zegreatrob/tools/test/git/GitHelper.kt +++ b/tools/git-test/src/jvmMain/kotlin/com/zegreatrob/tools/test/git/GitHelper.kt @@ -6,7 +6,6 @@ import org.ajoberstar.grgit.Grgit import org.ajoberstar.grgit.operation.BranchChangeOp import org.ajoberstar.grgit.operation.CommitOp import org.ajoberstar.grgit.operation.MergeOp.Mode -import org.ajoberstar.grgit.operation.RemoteAddOp import org.ajoberstar.grgit.operation.TagAddOp val defaultAuthors: List @@ -27,20 +26,15 @@ fun initializeGitRepo( if (addFileNames.isNotEmpty()) { gitAdapter.add(files = addFileNames.toTypedArray()) } - val grgit = Grgit.open(mapOf("dir" to directory)) commits.forEachIndexed { index, message -> gitAdapter.addCommitWithMessage(message) if (index == 0 && initialTag != null) { - grgit.addTag(initialTag) + gitAdapter.newAnnotatedTag(initialTag, "HEAD", "Funky Testerson", "funk@test.io") } } - grgit.remote.add( - fun RemoteAddOp.() { - this.name = "origin" - this.url = remoteUrl - }, - ) + gitAdapter.addRemote(name = "origin", url = remoteUrl) + val grgit = Grgit.open(mapOf("dir" to directory)) grgit.pull() grgit.branch.change( fun BranchChangeOp.() {