Skip to content

Compare Button in PR Timeline Shows Empty Result When Dropping a Commit #36390

@smartEBL

Description

@smartEBL

Description

The compare button in the PR timeline showing up when doing force pushes does not show the correct results in special cases.

To Reproduce:

  • Create a repo, initialize it with at least one commit on master
  • Create a new branch new_branch from master with at least n+1 commits (n>0)
  • Create a PR from new_branch into master
  • Use an interactive rebase to drop the last commit from new_branch locally
  • Use a force push to update the PR
  • Click the most recently added "Compare" button

Expected Behaviour:

  • Comparison showing the actual diff of the last commit which has been dropped

Behaviour:

  • Empty comparison stating "These branches are equal"

Worth mentioning:
When changing the order of the commits in the compare URL, the diff shows up. I would expect changing the order of commits in the compare URL to only change the removed/added state of lines but not showing a diff vs. not showing a diff at all.

This used to work in the past - however I'm not exactly sure when this behaviour got introduced. I guess it should be possible to figure out with some bisect approach.

Unfortunately I'm not able to provide a demo of the bug on the gitea demo site - I'm not not able to login there due to internal server errors and timeouts.

Gitea Version

1.25.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

PR after force push with the compare button:
Image

Here you end up when clicking the compare button:
Image

This is after manually changing the order of commit ids in the compare url:
Image

Git Version

2.49.1 (coming with gitea docker image)

Operating System

Ubuntu 22.04

How are you running Gitea?

Gitea runs in a docker container using the official gitea docker image.

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions