Run rebase sequence editor through shell

This commit is contained in:
Joe Tretter
2026-05-18 19:07:17 -05:00
parent ce58f46b48
commit f5bd5f5a60
2 changed files with 12 additions and 4 deletions

View File

@@ -19,8 +19,8 @@ android {
applicationId = "solutions.tretter.githugandroid" applicationId = "solutions.tretter.githugandroid"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 148 versionCode = 149
versionName = "0.1.147" versionName = "0.1.148"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true

View File

@@ -333,7 +333,7 @@ class GitRepositoryRuntime private constructor(
|cat ${todoFile.absolutePath.toShellSingleQuoted()} > "$1" |cat ${todoFile.absolutePath.toShellSingleQuoted()} > "$1"
|""".trimMargin(), |""".trimMargin(),
) )
setExecutable(true, true) setReadable(true, true)
} }
val arguments = GitSandboxEngine.tokenizeCommand(invocation.command).drop(1) val arguments = GitSandboxEngine.tokenizeCommand(invocation.command).drop(1)
val result = runGit( val result = runGit(
@@ -341,7 +341,7 @@ class GitRepositoryRuntime private constructor(
workingDir, workingDir,
arguments, arguments,
mapOf( mapOf(
"GIT_SEQUENCE_EDITOR" to editorScript.absolutePath, "GIT_SEQUENCE_EDITOR" to "${shellExecutable().toShellSingleQuoted()} ${editorScript.absolutePath.toShellSingleQuoted()}",
"GIT_EDITOR" to "true", "GIT_EDITOR" to "true",
), ),
) )
@@ -943,6 +943,14 @@ class GitRepositoryRuntime private constructor(
return "'" + replace("'", "'\"'\"'") + "'" return "'" + replace("'", "'\"'\"'") + "'"
} }
private fun shellExecutable(): String {
return when {
context != null -> "/system/bin/sh"
File("/bin/sh").exists() -> "/bin/sh"
else -> "sh"
}
}
private fun runGit( private fun runGit(
binary: File, binary: File,
workingDir: File, workingDir: File,