mirror of
https://gitea.com/gitea/tea.git
synced 2026-09-10 07:26:33 -04:00
Implements #1050. Prompt to delete the source branch after a successful tea pr merge, displaying the branch name because deletion cannot be undone. --delete-branch skips the prompt for scripts; this flag was requested in #810 for gh parity before being closed as an upstream Gitea bug. PullDeleteBranch takes a confirmation callback rather than prompting directly, fetching the pull request once and passing the branch name to the caller. The callback runs after state and permission checks so the user is not prompted for a deletion that would fail anyway. Deletion uses the API against the head repository, so it works for pull requests opened from a fork never checked out locally. tea pr clean is unsuitable because it requires a local repo and fails when the branch is not found locally. A matching local branch is still removed as a best effort, matched by commit rather than name so a branch with unpushed commits is left alone; PullClean makes the same choice and only accepts name matching behind --ignore-sha. The prompt is gated on stdin and stdout both being terminals, following the existing check in modules/context. TeaContext.IsInteractiveMode could not be used: despite its doc comment, it only reports whether any flag was passed, so a script running a bare tea pr merge <idx> would have blocked on a prompt it could not answer. Branches already deleted server-side, PRs still open, and head repositories the user cannot push to are each handled explicitly rather than surfacing a raw API error. Signed-off-by: Jan Baer <jan.s.baer@googlemail.com> |
||
|---|---|---|
| .. | ||
| CLI.md | ||
| docs.go | ||
| example-workflows.md | ||