Class: DesignManagement::Repository

Inherits:
Repository show all
Extended by:
Gitlab::Utils::Override
Defined in:
app/models/design_management/repository.rb

Constant Summary collapse

MANAGED_GIT_ATTRIBUTES =

We define static git attributes for the design repository as this repository is entirely GitLab-managed rather than user-facing.

Enable all uploaded files to be stored in LFS.

<<~GA.freeze
  /#{DesignManagement.designs_directory}/* filter=lfs diff=lfs merge=lfs -text
GA

Constants inherited from Repository

Repository::ARCHIVE_CACHE_TIME, Repository::ARCHIVE_CACHE_TIME_IMMUTABLE, Repository::AmbiguousRefError, Repository::CACHED_METHODS, Repository::CreateTreeError, Repository::MEMOIZED_CACHED_METHODS, Repository::METHOD_CACHES_FOR_FILE_TYPES, Repository::REF_ENVIRONMENTS, Repository::REF_KEEP_AROUND, Repository::REF_MERGE_REQUEST, Repository::REF_PIPELINES, Repository::RESERVED_REFS_NAMES

Instance Attribute Summary

Attributes inherited from Repository

#container, #disk_path, #full_path, #repo_type, #shard

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods inherited from Repository

#==, #add_branch, #add_tag, #after_change_head, #after_create, #after_create_branch, #after_push_commit, #after_remove_branch, #after_remove_tag, #ambiguous_ref?, #ancestor?, #archive_metadata, #async_remove_remote, #avatar, #before_change_head, #before_delete, #before_push_tag, #before_remove_branch, #before_remove_tag, #blob_at, #blob_at_branch, #blob_data_at, #blobs_at, #blobs_metadata, #branch_exists?, #branch_names_contains, #branches_sorted_by, #cached_methods, #changelog, #cherry_pick, #commit, #commit_by, #commit_count, #commit_count_for_ref, #commits, #commits_between, #commits_by, #compare_source_branch, #contribution_guide, #contributors, #create_dir, #create_file, #create_from_bundle, #create_if_not_exists, #create_ref, #delete_file, #delete_refs, #empty?, #exists?, #expand_ref, #expire_all_method_caches, #expire_avatar_cache, #expire_branch_cache, #expire_branches_cache, #expire_caches_for_tags, #expire_content_cache, #expire_emptiness_caches, #expire_exists_cache, #expire_root_ref_cache, #expire_statistics_caches, #expire_status_cache, #expire_tags_cache, #fetch_as_mirror, #fetch_ref, #fetch_source_branch!, #ff_merge, #file_on_head, #find_branch, #find_commits_by_message, #find_tag, #gitignore, #gitlab_ci_yml, #gitlab_ci_yml_for, #has_ambiguous_refs?, #hash, #head_commit, #head_tree, #inspect, #issue_template_names, #keep_around, #languages, #last_commit_for_path, #last_commit_id_for_path, #lfs_enabled?, #lfsconfig_for, #license, #license_blob, #license_key, #list_last_commits_for_tree, #local_branches, #lookup_cache, #ls_files, #merge, #merge_base, #merge_request_template_names, #merge_to_ref, #merged_branch_names, #merged_to_root_ref?, #method_missing, #multi_action, #new_commits, #next_branch, #path_to_repo, #project, #raw_repository, #readme, #readme_path, #rebase, #ref_exists?, #ref_names, #refresh_method_caches, #rendered_readme, #respond_to_missing?, #revert, #rm_branch, #rm_tag, #root_ref, #root_ref_sha, #route_map_for, #search_files_by_content, #search_files_by_name, #size, #squash, #submodule_links, #tag_exists?, #tag_names_contains, #tags, #tags_sorted_by, #tree, #update_file, #update_submodule, #user_defined_metrics_dashboard_paths, #with_cache_hooks, #xcode_project?

Methods included from Gitlab::RepositoryCacheAdapter

#cache, #cache_method_output, #cache_method_output_as_redis_set, #cache_method_output_asymmetrically, #cached_methods, #expire_method_caches, #memoize_method_output, #no_repository_fallback, #redis_hash_cache, #redis_set_cache, #request_store_cache

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(project) ⇒ Repository

Returns a new instance of Repository.


15
16
17
18
19
20
# File 'app/models/design_management/repository.rb', line 15

def initialize(project)
  full_path = project.full_path + Gitlab::GlRepository::DESIGN.path_suffix
  disk_path = project.disk_path + Gitlab::GlRepository::DESIGN.path_suffix

  super(full_path, project, shard: project.repository_storage, disk_path: disk_path, repo_type: Gitlab::GlRepository::DESIGN)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Repository

Instance Method Details

#attributes(path) ⇒ Object

Override of a method called on Repository instances but sent via method_missing to Gitlab::Git::Repository where it is defined


30
31
32
# File 'app/models/design_management/repository.rb', line 30

def attributes(path)
  info_attributes.attributes(path)
end

#attributes_at(_ref = nil) ⇒ Object

Override of a method called on Repository instances but sent via method_missing to Gitlab::Git::Repository where it is defined


42
43
44
# File 'app/models/design_management/repository.rb', line 42

def attributes_at(_ref = nil)
  info_attributes
end

#copy_gitattributes(_ref = nil) ⇒ Object


47
48
49
# File 'app/models/design_management/repository.rb', line 47

def copy_gitattributes(_ref = nil)
  true
end

#gitattribute(path, name) ⇒ Object

Override of a method called on Repository instances but sent via method_missing to Gitlab::Git::Repository where it is defined


36
37
38
# File 'app/models/design_management/repository.rb', line 36

def gitattribute(path, name)
  attributes(path)[name]
end

#info_attributesObject

Override of a method called on Repository instances but sent via method_missing to Gitlab::Git::Repository where it is defined


24
25
26
# File 'app/models/design_management/repository.rb', line 24

def info_attributes
  @info_attributes ||= Gitlab::Git::AttributesParser.new(MANAGED_GIT_ATTRIBUTES)
end