Files
Lunny Xiaoandbircni 44a4491137 feat: add --admin, --match-head-commit, --disable-auto, --required and --fill-first/--fill-verbose to the pr commands (#97)
`gh pr merge`, `checks` and `create` have options that `gt pr` lacked:

- `gt pr merge --admin` merges past the branch protection (Gitea's `force_merge`, for those who administer the repository). `--match-head-commit SHA` merges only while the head is still that commit and fails with the `head_mismatch` exit status otherwise, so a push after the review is not merged unseen. `--disable-auto` cancels the merge that `--auto` scheduled and merges nothing; with none scheduled it says so.
- `gt pr checks --required` shows and awaits only the checks that the protection rule of the base branch requires (`effective_branch_protection_name`, then its `status_check_contexts`, where `*` and `?` match). A flaky optional check no longer holds `--watch` back, and a branch that requires none has nothing to show.
- `gt pr create --fill-first` takes the title and body from the first commit of the branch whatever their number; `--fill-verbose` takes the body from the full message of every commit, oldest first. `--fill` is unchanged. `--fill`, `--fill-first` and `--fill-verbose` cannot be combined, like gh.

`gh pr checks --fail-fast` is not added: `gt pr checks --watch` already stops at the first failure.

Tested against fake servers, and on the disposable Gitea 28 instance by three integration tests: a merge with a moved head, an administrator merging past a protection that wants an approval, a scheduled merge that is canceled and then does not happen, required against optional checks with `--watch`, and `--fill-first` and `--fill-verbose` from a real clone. The test of the cancel showed that Gitea answers a cancel with nothing scheduled with the same bare 404 as for a missing pull request, which the code now reads as "nothing scheduled".

---------

Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/97
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2026-11-09 22:17:44 +00:00
..