File: git_repository.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (39 lines) | stat: -rw-r--r-- 1,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

module DesignManagement
  class GitRepository < ::Repository
    extend ::Gitlab::Utils::Override

    # 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.
    MANAGED_GIT_ATTRIBUTES = <<~GA.freeze
      /#{DesignManagement.designs_directory}/* filter=lfs diff=lfs merge=lfs -text
    GA

    # Override of a method called on Repository instances but sent via
    # method_missing to Gitlab::Git::Repository where it is defined
    def info_attributes
      @info_attributes ||= Gitlab::Git::AttributesParser.new(MANAGED_GIT_ATTRIBUTES)
    end

    # Override of a method called on Repository instances but sent via
    # method_missing to Gitlab::Git::Repository where it is defined
    def attributes(path)
      info_attributes.attributes(path)
    end

    # Override of a method called on Repository instances but sent via
    # method_missing to Gitlab::Git::Repository where it is defined
    def gitattribute(path, name)
      attributes(path)[name]
    end

    # Override of a method called on Repository instances but sent via
    # method_missing to Gitlab::Git::Repository where it is defined
    def attributes_at(_ref = nil)
      info_attributes
    end
  end
end