Squash merge message and compare incorrect following force-push #4955

Closed
opened 2025-11-02 06:08:57 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @klinki on GitHub (Feb 27, 2020).

Description

Squash and merge functionality gets broken when branch is rebased.

It seems it caches original parent commit and when the parent changes (after rebase) it doesn't reflect those changes.

  1. In commit message it shows unrelated messages from previous commits
  2. After completing squash and merge it shows invalid commits in PR

Try looking at commit message on provided URL and also try doing squash and merge.

Screenshots

gitea-screenshot

Originally created by @klinki on GitHub (Feb 27, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.11.1 - Git version: 2.25 - Operating system: Windows - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) https://try.gitea.io/klinki/squash-merge-rebase-bug/pulls/1 - [ ] No - [ ] Not relevant ## Description Squash and merge functionality gets broken when branch is rebased. It seems it caches original parent commit and when the parent changes (after rebase) it doesn't reflect those changes. 1) In commit message it shows unrelated messages from previous commits 2) After completing squash and merge it shows invalid commits in PR Try looking at commit message on provided URL and also try doing squash and merge. ## Screenshots ![gitea-screenshot](https://user-images.githubusercontent.com/1476175/75446436-b6b46280-5967-11ea-86d0-e97950c056f3.png)
GiteaMirror added the type/bug label 2025-11-02 06:08:57 -06:00
Author
Owner

@zeripath commented on GitHub (Mar 3, 2020):

Ok so presumably this is an issue with not recalculating the merge base each time.

Now this is strange because of the merge base is off then I think compare will probably be off too.

@zeripath commented on GitHub (Mar 3, 2020): Ok so presumably this is an issue with not recalculating the merge base each time. Now this is strange because of the merge base is off then I think compare will probably be off too.
Author
Owner

@zeripath commented on GitHub (Mar 3, 2020):

So the likely problem is here:

5abe1c52de/models/pull.go (L252)

We should be regenerating the merge base from the base to the head.

--
Edit: but realistically pull request checker should be doing this for us?!

@zeripath commented on GitHub (Mar 3, 2020): So the likely problem is here: https://github.com/go-gitea/gitea/blob/5abe1c52de533b52725b1e584db9fea6fb1b39ab/models/pull.go#L252 We should be regenerating the merge base from the base to the head. -- Edit: but realistically pull request checker should be doing this for us?!
Author
Owner

@zeripath commented on GitHub (Mar 3, 2020):

I've also changed the issue title as it is only the default suggested merge message that is incorrect and you can still merge

@zeripath commented on GitHub (Mar 3, 2020): I've also changed the issue title as it is only the default suggested merge message that is incorrect and you can still merge
Author
Owner

@zeripath commented on GitHub (Mar 3, 2020):

Ah there are two different issues here. Sorry I've misunderstood.

I've been looking at the merge messages only - these need to match the merge base we're actually going to use - now that could/should be precalculated in pull request checker.

Now, in the case of the compare after merge we need to use the merge base that we did use.

I think currently we may be showing commits that are on the base branch but are not on the head too - so it may be that we're doing the wrong diff.

@zeripath commented on GitHub (Mar 3, 2020): Ah there are two different issues here. Sorry I've misunderstood. I've been looking at the merge messages only - these need to match the merge base we're actually going to use - now that could/should be precalculated in pull request checker. Now, in the case of the compare after merge we need to use the merge base that we did use. I think currently we may be showing commits that are on the base branch but are not on the head too - so it may be that we're doing the wrong diff.
Author
Owner

@klinki commented on GitHub (Mar 4, 2020):

wow, that was quick, thanks :) Can't wait to test new version with this fix!

@klinki commented on GitHub (Mar 4, 2020): wow, that was quick, thanks :) Can't wait to test new version with this fix!
Author
Owner

@lunny commented on GitHub (Mar 5, 2020):

resolved by #10605

@lunny commented on GitHub (Mar 5, 2020): resolved by #10605
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4955