Skip to content

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

Merged
lafriks merged 4 commits into
go-gitea:masterfrom
zeripath:fix-10852
Mar 28, 2020
Merged

Convert plumbing.ErrObjectNotFound to git.ErrNotExist in getCommit#10862
lafriks merged 4 commits into
go-gitea:masterfrom
zeripath:fix-10852

Conversation

@zeripath
Copy link
Copy Markdown
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

Comment thread modules/git/repo_commit.go Outdated
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 28, 2020
Comment thread modules/git/repo_commit.go Outdated
@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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
…o-gitea#10862)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
@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 <art27@cantab.net>

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
@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