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

Propagate context and ensure git commands run in request context #17868

Merged
merged 65 commits into from
Jan 19, 2022

Conversation

zeripath
Copy link
Contributor

This PR continues the work in #17125 by progressively ensuring that git
commands run within the request context.

Signed-off-by: Andrew Thornton art27@cantab.net

@zeripath zeripath added type/refactoring Existing code has been cleaned up. There should be no new functionality. pr/wip This PR is not ready for review labels Nov 30, 2021
@zeripath zeripath marked this pull request as draft November 30, 2021 21:58
services/pull/pull.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 Nov 30, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@8581e2f). Click here to learn what that means.
The diff coverage is 67.43%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17868   +/-   ##
=======================================
  Coverage        ?   45.86%           
=======================================
  Files           ?      832           
  Lines           ?    92232           
  Branches        ?        0           
=======================================
  Hits            ?    42305           
  Misses          ?    43171           
  Partials        ?     6756           
Impacted Files Coverage Δ
cmd/admin.go 0.00% <0.00%> (ø)
cmd/doctor.go 0.00% <0.00%> (ø)
models/admin/notice.go 67.92% <0.00%> (ø)
models/db/engine.go 36.13% <ø> (ø)
modules/doctor/authorizedkeys.go 14.81% <0.00%> (ø)
modules/doctor/checkOldArchives.go 25.80% <0.00%> (ø)
modules/doctor/dbconsistency.go 6.83% <0.00%> (ø)
modules/doctor/dbversion.go 42.85% <0.00%> (ø)
modules/doctor/doctor.go 12.24% <0.00%> (ø)
modules/doctor/fix16961.go 38.76% <0.00%> (ø)
... and 135 more

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 8581e2f...6790d0a. Read the comment docs.

@zeripath zeripath force-pushed the propagate-context branch 2 times, most recently from 2a47658 to 0e9d56d Compare December 2, 2021 17:20
This PR continues the work in go-gitea#17125 by progressively ensuring that git
commands run within the request context.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
modules/context/api.go Show resolved Hide resolved
modules/git/repo_base.go Show resolved Hide resolved
6543 added a commit to 6543-forks/gitea that referenced this pull request Jan 8, 2022
Co-authored-by: 6543 <6543@obermui.de>
@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 Jan 13, 2022
@6543
Copy link
Member

6543 commented Jan 13, 2022

I vote for milestone v1.16 !!!

Copy link
Contributor

@Gusted Gusted left a comment

Choose a reason for hiding this comment

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

LGTM in general, wasn't able to spot a incorrect passed ctx(which is the only concern that could rise here).

@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 Jan 19, 2022
@lafriks
Copy link
Member

lafriks commented Jan 19, 2022

Naming should probably made more consistent: OpenRepositoryCtx, NewCommandContext, CloneWithContext (I mean Ctx, Context, WIthContext)

@zeripath
Copy link
Contributor Author

zeripath commented Jan 19, 2022

Well hopefully we'll be able to drop all of the non-contexted variants very soon - then everything will simply be OpenRepository NewCommand Clone etc.

@zeripath zeripath merged commit 5cb0c9a into go-gitea:main Jan 19, 2022
@zeripath zeripath deleted the propagate-context branch January 19, 2022 23:27
zjjhot pushed a commit to zjjhot/gitea that referenced this pull request Jan 20, 2022
* 'main' of https://github.com/go-gitea/gitea:
  Change initial TrustModel to committer (go-gitea#18335)
  refactor httplib (go-gitea#18338)
  Propagate context and ensure git commands run in request context (go-gitea#17868)
  Upgrade Alpine from 3.13 to 3.15 (go-gitea#18050)
  [skip ci] Updated translations via Crowdin
  Stop trimming preceding and suffixing spaces from editor filenames (go-gitea#18334)
  [skip ci] Updated translations via Crowdin
  Left-Align text in Unicode warning boxes (go-gitea#18331)
  Only warn on bidi but still escape non-bidi (go-gitea#18333)
  Fix incorrect OAuth message (go-gitea#18332)
  [skip ci] Updated translations via Crowdin
  Changelog for 1.16.0-rc1 (go-gitea#18309)
@zeripath zeripath mentioned this pull request Jan 20, 2022
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
…gitea#17868)

This PR continues the work in go-gitea#17125 by progressively ensuring that git
commands run within the request context.

This now means that the if there is a git repo already open in the context it will be used instead of reopening it.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants