manually merge PR by fast-forward crashes gitea #811

Closed
opened 2025-11-02 03:37:32 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @grissiom on GitHub (Jun 13, 2017).

  • Gitea version (or commit ref): 1.1.2
  • Git version: 2.11
  • Operating system: Windows
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
    Sorry that the log is on the working machine which could not access the Internet easily,

Description

https://github.com/go-gitea/gitea/blob/v1.1.2/models/pull.go#L520 assume the mergeCommit is not empty. But if the PR is merged manually by fast-forward, git rev-list --ancestry-path --merges ... will give empty output. So mergeCommit[:40] will crash the program by index out of range error.

I hope I've provided enough information. If you need the full log etc., please tell me and I will try to get more.

Originally created by @grissiom on GitHub (Jun 13, 2017). - Gitea version (or commit ref): 1.1.2 - Git version: 2.11 - Operating system: Windows - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: Sorry that the log is on the working machine which could not access the Internet easily, ## Description https://github.com/go-gitea/gitea/blob/v1.1.2/models/pull.go#L520 assume the `mergeCommit` is not empty. But if the PR is merged manually by fast-forward, `git rev-list --ancestry-path --merges ...` will give empty output. So `mergeCommit[:40]` will crash the program by index out of range error. I hope I've provided enough information. If you need the full log etc., please tell me and I will try to get more.
GiteaMirror added the type/bug label 2025-11-02 03:37:32 -06:00
Author
Owner

@ethantkoenig commented on GitHub (Jun 13, 2017):

The out-of-index error seems to have been fixed since v1.1.2 (#1420)

@ethantkoenig commented on GitHub (Jun 13, 2017): The out-of-index error seems to have been fixed since v1.1.2 (#1420)
Author
Owner

@grissiom commented on GitHub (Jun 13, 2017):

That commit treat the empty mergeCommit as errors. So how do you deal with fast-forward "merge"?

@grissiom commented on GitHub (Jun 13, 2017): That commit treat the empty `mergeCommit` as errors. So how do you deal with fast-forward "merge"?
Author
Owner

@ethantkoenig commented on GitHub (Dec 10, 2017):

This issue should be closed, it was fixed by #1989.

@ethantkoenig commented on GitHub (Dec 10, 2017): This issue should be closed, it was fixed by #1989.
Author
Owner

@lunny commented on GitHub (Dec 10, 2017):

@grissiom please feel free to reopen it.

@lunny commented on GitHub (Dec 10, 2017): @grissiom please feel free to reopen it.
Author
Owner

@grissiom commented on GitHub (Dec 19, 2017):

Yes, I found it was fixed. Thanks for you all!

@grissiom commented on GitHub (Dec 19, 2017): Yes, I found it was fixed. Thanks for you all!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#811