gogs: Failed to display commit with template error

When creating pull request by click “New Pull Request” button, gogs shows a web page for selecting base branch and compare branch. However after selecting the compare branch, the web page always jump to some error page like showed below.

2020-03-29_11-57

Git version

I’m using the latest version pulled from docker pull gogs/gogs:latest , Image Id 4d9b2aaae928.

git commit https://github.com/gogs/gogs/commit/470274204e6714c8062a49fa9e96450a67452133

$ ./gogs --version
Gogs version 0.12.0+dev

Operating system

$ docker exec -it git_gogs_1 cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.4
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
$ docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.39 (downgraded from 1.40)
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:06:30 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Database

$ file gogs.db 
gogs.db: SQLite 3.x database, last written using SQLite version 3030001

To Reproduce Steps to reproduce the behavior:

  1. Go to pull request page of any project.
  2. Click on New Pull Request
  3. Select some branch other than master for compare branch
  4. See error like screenshot shown above.

Can you reproduce the bug at https://try.gogs.io?

No, the error page did not show and I’ve no idea why.

Expected behavior

Continue to show diff page of the pull request.

Actual behavior

A plain web page shown saying that: template: repo/diff/box:82:21: executing "repo/diff/box" at <call $.IsImageFile $file.Name>: error calling call: revision does not exist

Screenshots

2020-03-29_11-57

Additional context

No error found in log/gogs.log.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Awesome! Thanks @onedou and @zTrix, will look into this tonight.

Tracked down the root issues (actually two bugs), with some improvements about handling file rename. PR coming soon.

Agreed.

I think the following steps should be a minimal setup for reproducing the issue:

  1. create a new git branch from some existing repo
  2. git rename some file and commit
  3. visit http://127.0.0.1:3000/<repo>/<project>/compare/master...<repo>:some_branch

After some debugging, I think this is a upstream bug of https://github.com/gogs/git-module

The issue happens when there are rename operation in git repo.

So, should we create a new issue on gogs/git-module ?

No need, that’s just a subproject of Gogs.