Closed
Description
Description
This is an edge case happening with the following conditions:
- an open PR with an assigned reviewer
- the reviewer interacted with the PR, Gitea stores user details about the interaction linked to a particular commit
- the author force-pushed to the PR
- git GC has run, causing a commit from the time of the interaction to be pruned
Observed behavior:
- the reviewer who interacted with the PR can't open PR Files Changed tab
- all other users can open it fine
Steps to replicate:
- In terminal
- Run Gitea with basic docker-compose from https://docs.gitea.io/en-us/install-with-docker/#basics
- In browser
- Install Gitea with SQLite database, admin user
author
- Install Gitea with SQLite database, admin user
- In terminal
- Shutdown Gitea
- Configure git GC to prune unreachable objects immediately, append to
gitea/conf/app.ini
:
[git] GC_ARGS = "--prune=now"
- Run Gitea again
- In browser, logged as
author
- Add SSH key
- Create repo
repo
with initializedmain
branch, userreviewer
, add him torepo
collaborators
- In terminal
- Clone
repo
- Checkout branch
feature
, edit a file, commit, push
- Clone
- In browser, logged as
author
- Create a PR for
feature
branch, assignreviewer
as reviewer
- Create a PR for
- In browser, logged as
reviewer
- Open the PR Files Changed tab
- Mark the changed file as Viewed
- In terminal
- Edit the file, amend the first commit, force-push
- In browser, logged as
author
- Site Administration > Maintenance Operations > Garbage collect all repositories > Run
- Confirm that the first commit was pruned - opening it returns 404, this is expected
- In browser, logged as
reviewer
- Open the PR, Files Changed tab - opening returns 500
- The following error is logged:
gitea | 2022/10/07 10:15:40 ...ers/web/repo/pull.go:715:ViewPullFiles() [E] [633fe02b] SyncAndGetUserSpecificDiff: exit status 128 - fatal: Invalid revision range 722a5b2dcdb1560ecfa0306c2492d1c5c7fd2a4e..47703d0b1e66ddf52827ff9596dc80f4de860089 gitea | - fatal: Invalid revision range 722a5b2dcdb1560ecfa0306c2492d1c5c7fd2a4e..47703d0b1e66ddf52827ff9596dc80f4de860089
722a5b…
is the pruned commit,47703d…
is the amended commit
Expected behavior:
- PR Files Changed tab can be opened by anyone
Workaround:
- close the PR and reopen as a new PR
Gitea Version
1.17.2
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
https://gist.github.com/zakjan/3e3c3574ac9df73d2e2bf0e717cd685d
Screenshots
Git Version
2.36.2
Operating System
macOS
How are you running Gitea?
Docker
Database
SQLite