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

Return go-get info on subdirs #15642

Merged
merged 8 commits into from
May 9, 2021

Conversation

zeripath
Copy link
Contributor

This PR is an alternative to #15628 and makes the go get handler a
handler.

Fix #15625

Close #15628

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

This PR is an alternative to go-gitea#15628 and makes the go get handler a
handler.

Fix go-gitea#15625

Close go-gitea#15628

Signed-off-by: Andrew Thornton <art27@cantab.net>
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"github.com/unknwon/com"
Copy link
Member

Choose a reason for hiding this comment

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

Just because you're already fiddling here, maybe we could replace com.Expand with os.Expand? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's doing something different from os.Expand.

It might be better to actually change this to use a go-template instead.

Copy link
Member

Choose a reason for hiding this comment

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

Both are used to expand variables in strings. A template would also work.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 27, 2021
@techknowlogick techknowlogick added the issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself label Apr 27, 2021
@lunny
Copy link
Member

lunny commented Apr 28, 2021

It seems this still not resolve the sub dir problem. And I think with a test is better.

@zeripath
Copy link
Contributor Author

@lunny what do you mean it does not resolve the subdir problem?

What are you expecting and what are you testing?

@zeripath
Copy link
Contributor Author

With this patch as it stands:

> curl 'http://localhost/gitea/administrator/admin/asjdaljsda?go-get=1'                      [18:40:08]
<!doctype html>
<html>
	<head>
		<meta name="go-import" content="localhost/gitea/administrator/admin git http://localhost/gitea/administrator/admin.git">
		<meta name="go-source" content="localhost/gitea/administrator/admin _ http://localhost/gitea/administrator/admin/src/branch/master{/dir} http://localhost/gitea/administrator/admin/src/branch/master{/dir}/{file}#L{line}">
	</head>
	<body>
		go get --insecure localhost/gitea/administrator/admin
	</body>
</html>

@6543
Copy link
Member

6543 commented Apr 30, 2021

I like the refactor ... can we still get some simple tests ;)

@zeripath
Copy link
Contributor Author

if you could tell me what this is actually supposed to return then a numbskull test would be possible but I don't understand whether it is doing the correct thing

@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 May 3, 2021
@zeripath
Copy link
Contributor Author

zeripath commented May 9, 2021

Test case added and conflicts resolved

@codecov-commenter
Copy link

Codecov Report

Merging #15642 (dd61d75) into main (a2df265) will decrease coverage by 0.02%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15642      +/-   ##
==========================================
- Coverage   43.97%   43.95%   -0.03%     
==========================================
  Files         678      679       +1     
  Lines       82047    82051       +4     
==========================================
- Hits        36081    36062      -19     
- Misses      40082    40119      +37     
+ Partials     5884     5870      -14     
Impacted Files Coverage Δ
routers/routes/goget.go 70.21% <70.21%> (ø)
routers/routes/web.go 90.84% <100.00%> (+4.35%) ⬆️
modules/notification/mail/mail.go 33.67% <0.00%> (-8.17%) ⬇️
modules/notification/ui/ui.go 58.97% <0.00%> (-6.84%) ⬇️
models/issue_comment.go 46.69% <0.00%> (-5.90%) ⬇️
models/unit.go 46.57% <0.00%> (-2.74%) ⬇️
modules/notification/base/null.go 76.31% <0.00%> (-2.64%) ⬇️
modules/notification/notification.go 85.12% <0.00%> (-2.48%) ⬇️
modules/log/event.go 59.90% <0.00%> (-1.89%) ⬇️
models/notification.go 65.18% <0.00%> (-0.89%) ⬇️
... and 14 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 a2df265...dd61d75. Read the comment docs.

@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 May 9, 2021
@zeripath
Copy link
Contributor Author

zeripath commented May 9, 2021

Make lgtm work

@zeripath zeripath merged commit 038e1db into go-gitea:main May 9, 2021
@zeripath zeripath deleted the fix-15625-go-get-handler branch May 9, 2021 21:50
zeripath added a commit to zeripath/gitea that referenced this pull request May 14, 2021
Backport go-gitea#15642

This PR is an alternative to go-gitea#15628 and makes the go get handler a
handler.

Fix go-gitea#15625

Close go-gitea#15628

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the backport/done All backports for this PR have been created label May 14, 2021
zeripath added a commit that referenced this pull request May 15, 2021
Backport #15642

This PR is an alternative to #15628 and makes the go get handler a
handler.

Fix #15625

Close #15628

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

Co-authored-by: 6543 <6543@obermui.de>
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 10, 2021


This PR is an alternative to go-gitea#15628 and makes the go get handler a
handler.

Fix go-gitea#15625

Close go-gitea#15628

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
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 issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself 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.

go get for modules in subdirs broken since 1.14.x
7 participants