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

Avoid recursing into sub-sub-sub-docs folders when looking for READMEs. #23695

Merged
merged 6 commits into from
Apr 11, 2023

Conversation

kousu
Copy link
Contributor

@kousu kousu commented Mar 25, 2023

Fixes a bug introduced in #22177 which allows finding READMEs like docs/docs/docs/.gitea/.github/docs/README.md

Fixes #23694

Fixes a bug introduced in go-gitea#22177
which allows finding READMEs like docs/docs/docs/.gitea/.github/docs/README.md

Fixes go-gitea#23694
routers/web/repo/view.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 25, 2023
@kousu
Copy link
Contributor Author

kousu commented Mar 25, 2023

Before (after commenting in the test that this enables):

$ make test-sqlite#TestViewRepoDirectoryReadme
go test  -c code.gitea.io/gitea/tests/integration -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
[...]
    --- FAIL: TestViewRepoDirectoryReadme/missing/special-subdir-nested (0.04s)
        testlogger.go:77: 2023/03/24 20:51:05 ...eb/routing/logger.go:98:func1() [I] [641e4579-50] router: completed GET /user2/readme-test/src/branch/special-subdir-nested/ for , 200 OK in 36.7ms @ repo/view.go:697(repo.Home)
        repo_test.go:356: 
                Error Trace:    /home/kousu/src/neurogitea/gitea/repo_test.go:356
                Error:          Should be false
                Test:           TestViewRepoDirectoryReadme/missing/special-subdir-nested
                Messages:       README should not have rendered
FAIL

After:

$ make test-sqlite#TestViewRepoDirectoryReadme
go test  -c code.gitea.io/gitea/tests/integration -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
[...]
=== TestViewRepoDirectoryReadme/missing/special-subdir-nested (/home/kousu/src/neurogitea/gitea/tests/integration/repo_test.go:347)
=== TestViewRepoDirectoryReadme/missing/symlink-loop (/home/kousu/src/neurogitea/gitea/tests/integration/repo_test.go:347)
PASS

@lunny lunny added the type/bug label Mar 25, 2023
@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 26, 2023
@lunny lunny added the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Mar 26, 2023
@lunny lunny added this to the 1.20.0 milestone Mar 26, 2023
@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 Apr 9, 2023
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2023

Codecov Report

Merging #23695 (75e30c3) into main (f521e88) will decrease coverage by 0.08%.
The diff coverage is 30.85%.

@@            Coverage Diff             @@
##             main   #23695      +/-   ##
==========================================
- Coverage   47.14%   47.06%   -0.08%     
==========================================
  Files        1149     1163      +14     
  Lines      151446   153738    +2292     
==========================================
+ Hits        71397    72356     +959     
- Misses      71611    72869    +1258     
- Partials     8438     8513      +75     
Impacted Files Coverage Δ
cmd/dump.go 0.66% <0.00%> (-0.01%) ⬇️
cmd/mailer.go 0.00% <0.00%> (ø)
cmd/manager.go 0.00% <0.00%> (ø)
cmd/manager_logging.go 0.00% <0.00%> (ø)
cmd/migrate_storage.go 5.76% <0.00%> (-0.12%) ⬇️
cmd/restore_repo.go 0.00% <0.00%> (ø)
cmd/web.go 0.00% <0.00%> (ø)
models/actions/run.go 1.63% <0.00%> (-0.10%) ⬇️
models/actions/runner.go 1.44% <ø> (ø)
models/organization/org_user.go 80.51% <0.00%> (-12.02%) ⬇️
... and 64 more

... and 112 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jolheiser jolheiser added the reviewed/prioritize-merge PR is in the merge queue. Merge as soon as possible, i.e. as edits by maintainers are not enabled label Apr 10, 2023
@jolheiser
Copy link
Member

Please update branch with main.

@jolheiser jolheiser enabled auto-merge (squash) April 11, 2023 02:37
@jolheiser jolheiser merged commit ef7fd78 into go-gitea:main Apr 11, 2023
@GiteaBot GiteaBot removed reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. reviewed/prioritize-merge PR is in the merge queue. Merge as soon as possible, i.e. as edits by maintainers are not enabled labels Apr 11, 2023
@GiteaBot
Copy link
Contributor

I was unable to create a backport for 1.19. @kousu, please send one manually. 🍵

@GiteaBot GiteaBot added the backport/manual No power to the bots! Create your backport yourself! label Apr 11, 2023
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 11, 2023
* upstream/main:
  Avoid recursing into sub-sub-sub-docs folders when looking for READMEs. (go-gitea#23695)
  [skip ci] Updated translations via Crowdin
  Use auto-updating, natively hoverable, localized time elements (go-gitea#23988)
  Reserve ".png" suffix for user/org names (go-gitea#23992)
  Allow adding SSH keys even if SSH server is disabled (go-gitea#24025)
  Add placeholder and aria attributes to release and wiki edit page (go-gitea#24031)
  Add --quiet option to gitea dump (go-gitea#22969)
  Remove "inverted" class on creating new label and cancel buttons (go-gitea#24030)
  Use actions job link as commit status URL instead of run link (go-gitea#24023)
  Make label templates have consistent behavior and priority (go-gitea#23749)
  Add actions support to package auth verification (go-gitea#23729)
@lunny lunny removed the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Jul 26, 2023
@GiteaBot
Copy link
Contributor

GiteaBot commented Aug 1, 2023

We lock pull requests 3 months after they were closed. If there's any need for further discussion, please open a new issue. 🍵

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/manual No power to the bots! Create your backport 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.

Special README paths can be infinitely nested
7 participants