Skip to content

When the git repository on storage is changed, the repository modal should also be updated #18088

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

Merged
merged 5 commits into from
Dec 24, 2021

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Dec 24, 2021

I saw some issues about "after pushing the git repository to Gitea, the Gitea web still shows the repository is empty" (I can not remember the issue number now ....)

And I meet the same problem today. This problem would be caused by some cases:

  1. An error occurs during the git pushing/receiving
  2. A user replaces the Gitea's empty repository manually

The reason behind the problem is that the repoModal.IsEmpty is out of sync of the real status of the repo.

This PR fixes the problem. When a user is viewing the repository web page, if the repoModal.IsEmpty is true, we check the git repository again to detect whether it is really empty.

This PR was tested on my side, and I can view the non-empty git repository correctly now.

Maybe we should fix more inconsistent data, please help to review and suggest, thank you

@codecov-commenter
Copy link

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #18088   +/-   ##
=======================================
  Coverage        ?   44.89%           
=======================================
  Files           ?      824           
  Lines           ?    91575           
  Branches        ?        0           
=======================================
  Hits            ?    41114           
  Misses          ?    43861           
  Partials        ?     6600           
Impacted Files Coverage Δ
routers/web/repo/view.go 39.50% <28.57%> (ø)

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 7cc4449...d3888f8. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 24, 2021
@zeripath
Copy link
Contributor

TBH the IsEmpty flag is deeply broken and should be removed with the UI changed to manage to cope with empty repos.

For example it's possible for a repository to be non-empty by that flag but still 500 because there are no branches - only tags -or the default branch is non-extant as it has been 0-pushed.

@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 Dec 24, 2021
@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 Dec 24, 2021
@wxiaoguang
Copy link
Contributor Author

TBH the IsEmpty flag is deeply broken and should be removed with the UI changed to manage to cope with empty repos.

That's very helpful. I added more comments there.

@wxiaoguang wxiaoguang merged commit 26070eb into go-gitea:main Dec 24, 2021
@wxiaoguang wxiaoguang deleted the fix-repo-empty branch December 24, 2021 15:37
@wxiaoguang wxiaoguang added this to the 1.16.0 milestone Jan 28, 2022
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
…hould also be updated (go-gitea#18088)

User would keep seeing an empty repo if:
* An error occurs during the first git pushing/receiving
* A user replaces the Gitea's empty repository manually
Fix: when a user is viewing the repository web page, if the repoModal.IsEmpty is true, we check the git repository again to detect whether it is really empty.

However: the IsEmpty flag is deeply broken and should be removed. For example it's possible for a repository to be non-empty by that flag but still 500 because there are no branches - only tags -or the default branch is non-extant as it has been 0-pushed.
@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/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants