Fix help callout anchoring and Push remote setup

- Anchor startup help callouts inside the scrollable pane workspace so they scroll with the exercise and terminal content they point at.
- Rebuild the Push level remote as a bare sibling repo with a temporary worktree for the remote-only commit, avoiding Android non-bare remote push failures.
- Leave a visible local worktree edit in Push while enabling rebase autostash so status, diff, and pull --rebase all behave as expected.
- Add native Push setup coverage for diverged status output, plain diff output, and clean pull --rebase behavior.
This commit is contained in:
Joe Tretter
2026-05-07 09:57:50 -05:00
parent 91e2df3ffe
commit 565028f64a
5 changed files with 184 additions and 114 deletions

View File

@@ -498,27 +498,38 @@ class GitRepositoryRuntime private constructor(
writeFile("file2")
commitIn(sandbox, "Second commit", "file2")
val remoteWorkTree = File(sandbox.parentFile ?: sandbox, "${sandbox.name}-origin")
val parent = sandbox.parentFile ?: sandbox
val remoteDir = File(parent, "${sandbox.name}-origin.git")
val remoteWorkTree = File(parent, "${sandbox.name}-origin-work")
remoteDir.deleteRecursively()
remoteWorkTree.deleteRecursively()
remoteDir.mkdirs()
remoteWorkTree.mkdirs()
val initResult = runGit(nativeGit, remoteWorkTree, listOf("init", "-b", "master"))
if (initResult.exitCode != 0) {
runGit(nativeGit, remoteWorkTree, listOf("init"))
runGit(nativeGit, remoteWorkTree, listOf("checkout", "-B", "master"))
}
runGit(nativeGit, remoteWorkTree, listOf("config", "receive.denyCurrentBranch", "ignore"))
runGit(nativeGit, sandbox, listOf("remote", "add", "push-setup-origin", File(remoteWorkTree, ".git").absolutePath))
runGit(nativeGit, remoteDir, listOf("init", "--bare", "-b", "master"))
runGit(nativeGit, sandbox, listOf("remote", "add", "push-setup-origin", remoteDir.absolutePath))
runGit(nativeGit, sandbox, listOf("push", "push-setup-origin", "master"))
runGit(nativeGit, sandbox, listOf("remote", "remove", "push-setup-origin"))
runGit(nativeGit, remoteWorkTree, listOf("checkout", "-f", "master"))
fun runRemoteGit(arguments: List<String>): ProcessExecutionResult {
return runGit(
nativeGit,
sandbox,
listOf("--git-dir", remoteDir.absolutePath, "--work-tree", remoteWorkTree.absolutePath) + arguments,
)
}
runRemoteGit(listOf("checkout", "-f", "master"))
File(remoteWorkTree, "file4").writeText("file4\n")
commitIn(remoteWorkTree, "Fourth commit", "file4")
runRemoteGit(listOf("add", "file4"))
runRemoteGit(listOf("commit", "-m", "Fourth commit"))
writeFile("file3")
commitIn(sandbox, "Third commit", "file3")
runGit(nativeGit, sandbox, listOf("remote", "add", "origin", File(remoteWorkTree, ".git").absolutePath))
runGit(nativeGit, sandbox, listOf("remote", "add", "origin", remoteDir.absolutePath))
runGit(nativeGit, sandbox, listOf("fetch", "origin"))
runGit(nativeGit, sandbox, listOf("branch", "--set-upstream-to=origin/master", "master"))
runGit(nativeGit, sandbox, listOf("config", "rebase.autoStash", "true"))
File(sandbox, "file3").appendText("local worktree change\n")
}
private fun filesForSetupCommit(files: List<GitFile>, index: Int, commitCount: Int): List<GitFile> {