Skip to content
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

Convert plumbing.ErrObjectNotFound to git.ErrNotExist in getCommit #10862

Merged
merged 4 commits into from
Mar 28, 2020

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Mar 28, 2020

Similar to a number of other bugs we need to handle plumbing.ErrObjectNotFound and convert to git.ErrNotExist appropriately.

Fix #10852

modules/git/repo_commit.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 28, 2020
modules/git/repo_commit.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 28, 2020
@codecov-io
Copy link

codecov-io commented Mar 28, 2020

Codecov Report

Merging #10862 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10862      +/-   ##
==========================================
- Coverage   43.40%   43.39%   -0.01%     
==========================================
  Files         593      593              
  Lines       83271    83276       +5     
==========================================
+ Hits        36140    36141       +1     
  Misses      42640    42640              
- Partials     4491     4495       +4     
Impacted Files Coverage Δ
modules/git/repo_commit.go 53.45% <100.00%> (-0.22%) ⬇️
services/pull/check.go 50.00% <0.00%> (-3.05%) ⬇️
modules/git/command.go 86.95% <0.00%> (-2.61%) ⬇️
services/pull/pull.go 34.70% <0.00%> (-1.18%) ⬇️
models/gpg_key.go 53.95% <0.00%> (+0.52%) ⬆️
routers/repo/view.go 36.82% <0.00%> (+0.67%) ⬆️
modules/log/event.go 65.64% <0.00%> (+1.02%) ⬆️
models/unit.go 44.44% <0.00%> (+2.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea67e56...13bb269. Read the comment docs.

if err == nil {
gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
}
// if we get a plumbing.ErrObjectNotFound here then the repository is broken and it should be 500
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I'd prefer a "your repository is broken" error. 😉

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 28, 2020
@lafriks lafriks merged commit 052bff0 into go-gitea:master Mar 28, 2020
@lafriks
Copy link
Member

lafriks commented Mar 28, 2020

Please send backport

@zeripath zeripath deleted the fix-10852 branch March 28, 2020 19:39
zeripath added a commit to zeripath/gitea that referenced this pull request Mar 28, 2020
@zeripath zeripath added the backport/done All backports for this PR have been created label Mar 28, 2020
zeripath added a commit that referenced this pull request Mar 29, 2020
…10862) (#10868)

Backport #10862

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Antoine GIRARD <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

500 Internal Server Error when accessing nonexistent commit
7 participants