Skip to content

Crash when changing branches #3238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks
trebonian opened this issue Dec 20, 2017 · 2 comments
Closed
5 tasks

Crash when changing branches #3238

trebonian opened this issue Dec 20, 2017 · 2 comments
Labels
Milestone

Comments

@trebonian
Copy link

  • Gitea version (or commit ref): 7b28154
  • Git version: 2.15.0
  • Operating system: Alpine Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • [ X] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • [ X] No
    • Not relevant
  • Log gist:

Description

Apologies for not making a small reproducible example.

The new git commit info from Faster Commit Lookup #91 causes crashes when changing branches in gitea from the default branch.

In the file vendor/code.gitea.io/git/commit_info.go:

This is because the "git rev-list HEAD -- " uses the HEAD from the default branch. If the entryPath contains a file, or directory that is not present in the default branch - then the rev-list returns no files and this causes a crash.

I believe the line should be changed from:
command := NewCommand("rev-list", "-1", "HEAD", "--", entryPath)
to:
command := NewCommand("rev-list", "-1", state.headCommit.ID.String(), "--", entryPath)

Making this change seems to have fixed the issue for me

...

Screenshots

@lunny
Copy link
Member

lunny commented Dec 20, 2017

go-gitea/git#98 will fix this.

@lunny lunny added the type/bug label Dec 20, 2017
@lunny lunny added this to the 1.4.0 milestone Dec 20, 2017
@lunny
Copy link
Member

lunny commented Dec 20, 2017

still be fixed by #3240

@lunny lunny closed this as completed Dec 20, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants