gitlab-org--gitlab-foss/spec/factories
Zeger-Jan van de Weg 896c0bdbfb
Allow public forks to be deduplicated
When a project is forked, the new repository used to be a deep copy of everything
stored on disk by leveraging `git clone`. This works well, and makes isolation
between repository easy. However, the clone is at the start 100% the same as the
origin repository. And in the case of the objects in the object directory, this
is almost always going to be a lot of duplication.

Object Pools are a way to create a third repository that essentially only exists
for its 'objects' subdirectory. This third repository's object directory will be
set as alternate location for objects. This means that in the case an object is
missing in the local repository, git will look in another location. This other
location is the object pool repository.

When Git performs garbage collection, it's smart enough to check the
alternate location. When objects are duplicated, it will allow git to
throw one copy away. This copy is on the local repository, where to pool
remains as is.

These pools have an origin location, which for now will always be a
repository that itself is not a fork. When the root of a fork network is
forked by a user, the fork still clones the full repository. Async, the
pool repository will be created.

Either one of these processes can be done earlier than the other. To
handle this race condition, the Join ObjectPool operation is
idempotent. Given its idempotent, we can schedule it twice, with the
same effect.

To accommodate the holding of state two migrations have been added.
1. Added a state column to the pool_repositories column. This column is
managed by the state machine, allowing for hooks on transitions.
2. pool_repositories now has a source_project_id. This column in
convenient to have for multiple reasons: it has a unique index allowing
the database to handle race conditions when creating a new record. Also,
it's nice to know who the host is. As that's a short link to the fork
networks root.

Object pools are only available for public project, which use hashed
storage and when forking from the root of the fork network. (That is,
the project being forked from itself isn't a fork)

In this commit message I use both ObjectPool and Pool repositories,
which are alike, but different from each other. ObjectPool refers to
whatever is on the disk stored and managed by Gitaly. PoolRepository is
the record in the database.
2018-12-07 19:18:37 +01:00
..
ci Merge branch 'security-stored-xss-for-environments' into 'master' 2018-11-28 19:07:29 -05:00
clusters Fallback to admin token for project clusters only 2018-12-04 15:44:33 +13:00
gitaly Add handling for commit/tags with big messages 2018-05-18 20:51:10 +02:00
abuse_reports.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
appearances.rb remove some lint 2018-03-26 09:07:46 -04:00
application_settings.rb Ensure ApplicationSetting#performance_bar_allowed_group_id is properly set when retrieved from cache 2018-05-29 10:38:59 +02:00
award_emoji.rb Prevent awarding emoji when a project is archived 2018-04-11 10:51:43 +02:00
badge.rb Projects and groups badges API 2018-03-05 17:51:40 +00:00
board_group_recent_visit.rb Automatically navigate to last board visited 2018-10-26 12:49:16 +00:00
board_project_recent_visit.rb Automatically navigate to last board visited 2018-10-26 12:49:16 +00:00
boards.rb Bring one group board to CE 2018-03-03 12:56:17 -03:00
broadcast_messages.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
chat_names.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
chat_teams.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
commit_statuses.rb Add unit tests for CommitStatus and Ci::Stage 2018-10-02 17:08:11 +02:00
commits.rb Move spec helpers/matchers/shared examples/contexts to their relevant folder 2018-04-23 12:20:30 +02:00
container_repositories.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
conversational_development_index_metrics.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
deploy_keys_projects.rb Merge branch 'sh-migrate-can-push-to-deploy-keys-projects-10-3' into 'security-10-3' 2018-01-16 17:04:51 -08:00
deploy_tokens.rb Rename special deploy token to make it more descriptive 2018-04-20 12:18:41 -05:00
deployments.rb Squashed commit of the following: 2018-11-06 10:54:27 +09:00
emails.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
environments.rb Squashed commit of the following: 2018-11-06 10:54:27 +09:00
events.rb Refactor EventFilter and increase its test coverage 2018-09-26 18:34:26 +02:00
file_uploaders.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
fork_network_members.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
fork_networks.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
gpg_key_subkeys.rb Move spec helpers/matchers/shared examples/contexts to their relevant folder 2018-04-23 12:20:30 +02:00
gpg_keys.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
gpg_signature.rb Move spec helpers/matchers/shared examples/contexts to their relevant folder 2018-04-23 12:20:30 +02:00
group_custom_attributes.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
group_members.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
groups.rb Resolve "Namespace factory is problematic" 2018-04-23 15:48:26 +00:00
identities.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
import_export_uploads.rb Update Import/Export to use object storage (based on aa feature flag) 2018-07-06 15:46:18 +02:00
import_state.rb Removes all the irrelevant import related code and columns 2018-11-27 12:58:13 +00:00
instance_configuration.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
internal_ids.rb More flexible way of internal id generation. 2018-03-16 13:35:25 +01:00
issues.rb Hides Close MR button on merged MR 2018-10-02 16:17:55 +02:00
keys.rb Validate SSH keys through the sshkey gem 2018-02-16 11:32:08 -05:00
label_links.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
label_priorities.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
labels.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
lfs_file_locks.rb Backport of LFS File Locking API 2018-02-07 09:04:00 -05:00
lfs_objects.rb Make all uses of fixture_file_upload use relative paths 2018-06-07 09:54:41 -05:00
lfs_objects_projects.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
lists.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
merge_request_diff_files.rb Add factory for MergeRequestDiff and MergeRequestDiffFile 2018-11-07 11:26:46 +08:00
merge_request_diffs.rb Add factory for MergeRequestDiff and MergeRequestDiffFile 2018-11-07 11:26:46 +08:00
merge_requests.rb Move ci_environments_status to a model 2018-10-18 16:12:16 +02:00
merge_requests_closing_issues.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
milestones.rb Merge branch 'issue_36138' into 'master' 2018-08-28 07:49:09 +00:00
namespaces.rb Resolve "Namespace factory is problematic" 2018-04-23 15:48:26 +00:00
notes.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
notification_settings.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
oauth_access_grants.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
oauth_access_tokens.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
oauth_applications.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
pages_domains.rb Add HTTPS-only pages 2018-03-22 19:58:36 +01:00
personal_access_tokens.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
pool_repositories.rb Allow public forks to be deduplicated 2018-12-07 19:18:37 +01:00
programming_languages.rb Add repository languages for projects 2018-08-01 18:58:29 +02:00
project_auto_devops.rb Add timed incremental rollout to Auto DevOps 2018-10-05 21:14:59 +02:00
project_custom_attributes.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
project_deploy_tokens.rb Include ProjectDeployTokens 2018-04-06 21:20:16 -05:00
project_group_links.rb API: Add shared project's expiration date 2018-08-21 11:23:05 +02:00
project_hooks.rb Merge branch 'jej/mattermost-notification-confidentiality-10-6' into 'security-10-6' 2018-04-05 08:41:56 +02:00
project_members.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
project_statistics.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
project_wikis.rb Bump Gitaly to 0.98.0 2018-05-07 14:10:04 +02:00
projects.rb Removes all the irrelevant import related code and columns 2018-11-27 12:58:13 +00:00
prometheus_metrics.rb Add # frozen_string_literal: true 2018-09-04 12:19:23 +02:00
protected_branches.rb Resolve "Rename the Master role to Maintainer" Backend 2018-07-11 14:36:08 +00:00
protected_tags.rb Resolve "Rename the Master role to Maintainer" Backend 2018-07-11 14:36:08 +00:00
redirect_routes.rb Remove permanent redirects 2018-03-28 14:12:08 +02:00
releases.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
remote_mirrors.rb Backports every CE related change from ee-5484 to CE 2018-05-07 11:59:51 +02:00
repository_languages.rb Add repository languages for projects 2018-08-01 18:58:29 +02:00
resource_label_events.rb Use ResourceLabelEvent for tracking label changes 2018-09-07 13:39:20 +00:00
sent_notifications.rb Make user/author use project.creator in most factories 2018-01-31 18:31:21 +01:00
sequences.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
service_hooks.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
services.rb Usage ping - Differentiate Jira Server and Cloud 2018-11-07 11:28:04 -06:00
shards.rb Rename the Repository table to PoolRepository 2018-11-27 13:41:46 +01:00
snippets.rb Make user/author use project.creator in most factories 2018-01-31 18:31:21 +01:00
spam_logs.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
subscriptions.rb Make user/author use project.creator in most factories 2018-01-31 18:31:21 +01:00
system_hooks.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
system_note_metadata.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
term_agreements.rb Messaging on terms page when user already accepted 2018-06-04 22:22:11 +02:00
terms.rb Store application wide terms 2018-05-04 13:52:55 +02:00
timelogs.rb Make user/author use project.creator in most factories 2018-01-31 18:31:21 +01:00
todos.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
trending_project.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
u2f_registrations.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
uploads.rb Fix DynamicAttributeDefinedStatically cop 2018-09-21 12:37:57 +05:00
user_agent_details.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
user_callouts.rb Change UserCallout feautre_name to enum 2018-02-03 00:18:25 +01:00
user_custom_attributes.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
user_preferences.rb Resolve "Filter discussion (tab) by comments or activity in issues and merge requests" 2018-10-23 09:49:45 +00:00
user_statuses.rb Allow users to set a status 2018-07-30 15:01:26 +02:00
users.rb Use the correct email address when committing via a file service 2018-09-17 14:14:58 +01:00
users_star_projects.rb Extend API for importing a project export with overwrite support 2018-04-06 15:23:49 +00:00
web_hook_log.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
wiki_directories.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
wiki_pages.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00