pr: commit worktree changes before push; fix merge/pr order docs

POST /tasks/{id}/pr used to push the branch as-is, so uncommitted
worktree changes never reached the PR (empty diff). Now, after all
skip checks pass, the endpoint commits the worktree on host/<task>
(guarded: refuses when the worktree is on another branch), cleans
__pycache__/*.pyc like host.py merge does, and falls back to the
cloud identity when no git identity is configured. Nothing-to-commit
proceeds. Docs corrected: PR comes after status-merge and before
any local git merge (which deletes branch+worktree).
This commit is contained in:
host committed 2026-10-26 15:20:02 +08:00
1 parent b984171f27
commit 0b96b2929c
5 files changed
+263 -10

No files matched your search

+6
View File
@@ -140,6 +140,12 @@ class _ServerCase(unittest.TestCase):
if remote_fail:
return _result(1, "", "no remote")
return _result(0, "https://example.com/repo.git\n")
if "branch" in cmd:
# 假 worktree 正好在自己的 host/<任务名> 分支上:
# worktree 目录名就是任务 id(见 _worktree)。
return _result(0, "host/%s\n" % os.path.basename(cwd or ""))
if "add" in cmd or "commit" in cmd:
return _result(0, "")
if "push" in cmd:
if push_fail:
return _result(1, "", "push rejected")