Skip to content

[Bug]: Forgejo repositories with only fast-forward-only merges hide the merge button #32715

Closed

Description

@dilantha

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. On a self-hosted Forgejo instance, create a repository and disable Merge commit, Squash, Rebase, and Rebase with merge commit, leaving only Fast-forward only enabled. The API then reports allow_fast_forward_only_merge: true, every other allow_* merge flag false, and default_merge_style: "fast-forward-only".
  2. Add the repository to a T3 Code project and open a pull request from a branch in T3 Code.
  3. Open the pull request's merge controls.

Expected behavior

T3 Code offers a merge action that performs a Forgejo fast-forward-only merge (Do: "fast-forward-only"). At minimum, the action should be shown disabled with an explanation.

Actual behavior

No merge button appears at all. The available merge-method list is empty because T3 Code only maps Forgejo's allow_merge_commits, allow_squash_merge, and allow_rebase flags. A repository whose only enabled style is fast-forward-only therefore reports no merge capabilities, and the UI gates the merge control on that list. If the action is forced from the client, it throws No merge method is available for this repository.

Impact

Major degradation or frequent failure: fast-forward-only is the only merge style allowed on these repositories, so T3 Code cannot merge any of their pull requests.

Version or commit

0.1.7 (latest release at the time of the report)

Environment

macOS desktop app; self-hosted Forgejo 17.0.1+gitea-1.22.0

Logs or stack traces

None available, because the button is hidden before any API call. The client-side guard is visible in the bundled app:

throw Error("No merge method is available for this repository.")

Workaround

Enable the repository's Rebase style (allow_rebase: true) in addition to fast-forward-only. T3 Code then offers "Rebase and merge", which still creates no merge commit, though it rewrites branch commits when the base has moved.

Root cause and suggested fix

In packages/source-control-forgejo:

  • forgejoPullRequestJson.ts parses allow_merge_commits, allow_squash_merge, allow_rebase, and allow_rebase_update, but not allow_fast_forward_only_merge.
  • ForgejoPullRequestProvider.ts sets mergeCapabilities from those three flags and advertises mergeMethods: ["merge", "squash", "rebase"].
  • runAction sends Do: input.mergeMethod ?? "merge".

The UI filters the advertised methods by mergeCapabilities, so a fast-forward-only repository yields zero methods and hides the control.

Forgejo accepts Do: "fast-forward-only" and exposes the flag as allow_fast_forward_only_merge. A fix needs a distinct merge method on the shared PullRequestMergeMethod union, because fast-forward is not Rebase (it refuses when the branch has moved instead of rewriting it). It also needs a UI label, the Forgejo capability mapping, and the action-to-Do mapping. Other providers' advertised methods would stay unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions