summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/attributes_at_ref_parser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git/attributes_at_ref_parser.rb')
-rw-r--r--lib/gitlab/git/attributes_at_ref_parser.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/git/attributes_at_ref_parser.rb b/lib/gitlab/git/attributes_at_ref_parser.rb
new file mode 100644
index 00000000000..26b5bd520d5
--- /dev/null
+++ b/lib/gitlab/git/attributes_at_ref_parser.rb
@@ -0,0 +1,14 @@
+module Gitlab
+ module Git
+ # Parses root .gitattributes file at a given ref
+ class AttributesAtRefParser
+ delegate :attributes, to: :@parser
+
+ def initialize(repository, ref)
+ blob = repository.blob_at(ref, '.gitattributes')
+
+ @parser = AttributesParser.new(blob&.data)
+ end
+ end
+ end
+end