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

Set is_empty in fixtures #18869

Merged
merged 4 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integrations/gitea-repositories-meta/user30/empty.git/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/main
6 changes: 6 additions & 0 deletions integrations/gitea-repositories-meta/user30/empty.git/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[core]
bare = true
repositoryformatversion = 0
filemode = false
symlinks = false
ignorecase = true
32 changes: 31 additions & 1 deletion models/fixtures/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
owner_name: user2
lower_name: repo2
name: repo2
is_empty: false
is_archived: false
is_private: true
num_issues: 2
Expand All @@ -40,6 +41,7 @@
owner_name: user3
lower_name: repo3
name: repo3
is_empty: false
is_private: true
num_issues: 1
num_closed_issues: 0
Expand All @@ -56,6 +58,7 @@
owner_name: user5
lower_name: repo4
name: repo4
is_empty: false
is_private: false
num_issues: 0
num_closed_issues: 0
Expand Down Expand Up @@ -143,6 +146,7 @@
owner_name: user12
lower_name: repo10
name: repo10
is_empty: false
is_private: false
num_issues: 0
num_closed_issues: 0
Expand All @@ -160,6 +164,7 @@
owner_name: user13
lower_name: repo11
name: repo11
is_empty: false
is_private: false
num_issues: 0
num_closed_issues: 0
Expand Down Expand Up @@ -217,7 +222,7 @@
owner_name: user2
lower_name: repo15
name: repo15
is_empty: true
is_empty: false
Copy link
Member Author

Choose a reason for hiding this comment

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

This repo contains commits, so it is not empty. user30/empty is the new empty repo.

is_private: true
status: 0

Expand All @@ -227,6 +232,7 @@
owner_name: user2
lower_name: repo16
name: repo16
is_empty: false
is_private: true
num_issues: 0
num_closed_issues: 0
Expand Down Expand Up @@ -460,6 +466,7 @@
owner_name: user2
lower_name: repo20
name: repo20
is_empty: false
is_private: true
num_stars: 0
num_forks: 0
Expand All @@ -486,6 +493,7 @@
owner_name: user2
lower_name: utf8
name: utf8
is_empty: false
is_private: false
status: 0

Expand Down Expand Up @@ -521,6 +529,7 @@
owner_name: user2
lower_name: commits_search_test
name: commits_search_test
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -534,6 +543,7 @@
owner_name: user2
lower_name: git_hooks_test
name: git_hooks_test
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -547,6 +557,7 @@
owner_name: limited_org
lower_name: public_repo_on_limited_org
name: public_repo_on_limited_org
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -560,6 +571,7 @@
owner_name: limited_org
lower_name: private_repo_on_limited_org
name: private_repo_on_limited_org
is_empty: false
is_private: true
num_stars: 0
num_forks: 0
Expand All @@ -573,6 +585,7 @@
owner_name: privated_org
lower_name: public_repo_on_private_org
name: public_repo_on_private_org
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -586,6 +599,7 @@
owner_name: privated_org
lower_name: private_repo_on_private_org
name: private_repo_on_private_org
is_empty: false
is_private: true
num_stars: 0
num_forks: 0
Expand All @@ -598,6 +612,7 @@
owner_name: user2
lower_name: glob
name: glob
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -624,6 +639,7 @@
owner_name: user27
lower_name: template1
name: template1
is_empty: false
is_private: false
is_template: true
num_stars: 0
Expand Down Expand Up @@ -652,6 +668,7 @@
owner_name: org26
lower_name: repo_external_tracker
name: repo_external_tracker
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -665,6 +682,7 @@
owner_name: org26
lower_name: repo_external_tracker_numeric
name: repo_external_tracker_numeric
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -678,6 +696,7 @@
owner_name: org26
lower_name: repo_external_tracker_alpha
name: repo_external_tracker_alpha
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand All @@ -692,6 +711,7 @@
owner_name: user27
lower_name: repo49
name: repo49
is_empty: false
is_private: false
num_stars: 0
num_forks: 0
Expand Down Expand Up @@ -738,3 +758,13 @@
num_projects: 0
num_closed_projects: 0
status: 0

-
id: 52
owner_id: 30
owner_name: user30
lower_name: empty
name: empty
is_empty: true
is_private: true
status: 0
2 changes: 1 addition & 1 deletion models/fixtures/user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@
is_restricted: true
avatar: avatar29
avatar_email: user30@example.com
num_repos: 2
num_repos: 3
is_active: true
prohibit_login: true

Expand Down
8 changes: 4 additions & 4 deletions services/repository/files/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ func TestGetContentsOrListErrors(t *testing.T) {

func TestGetContentsOrListOfEmptyRepos(t *testing.T) {
unittest.PrepareTestEnv(t)
ctx := test.MockContext(t, "user2/repo15")
ctx.SetParams(":id", "15")
test.LoadRepo(t, ctx, 15)
test.LoadUser(t, ctx, 2)
ctx := test.MockContext(t, "user30/empty")
ctx.SetParams(":id", "52")
test.LoadRepo(t, ctx, 52)
test.LoadUser(t, ctx, 30)
test.LoadGitRepo(t, ctx)
defer ctx.Repo.GitRepo.Close()

Expand Down