Skip to content

Commit

Permalink
[patch] more transitional adapter work
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfmurdock committed Sep 19, 2024
1 parent 99bd29a commit 442de76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>
Expand All @@ -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", "[email protected]")
}
}

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.() {
Expand Down

0 comments on commit 442de76

Please sign in to comment.