lib/gitlab_git/repository.rb
def parse_gitmodules(commit, content)
        results = {}

        current = ""
        content.split("\n").each do |txt|
          if txt.match(/^\s*\[/)
            current = txt.match(/(?<=").*(?=")/)[0]
            results[current] = {}
          else
            next unless results[current]
            match_data = txt.match(/(\w+)\s*=\s*(.*)/)
            next unless match_data
            target = match_data[2].chomp
            results[current][match_data[1]] = target

            if match_data[1] == "path"
              begin
                results[current]["id"] = blob_content(commit, target)
              rescue InvalidBlobName
                results.delete(current)
              end
            end
          end
        end

        results
      end
# Parses the contents of a .gitmodules file and returns a hash of
# submodule information.
Parses the contents of a .gitmodules file and returns a hash of
submodule information.
Parses the contents of a . gitmodules file and returns a hash of submodule information .
def parse_gitmodules(commit, content)
        results = {}
        current = ""
        content.split("\n").each do |txt|
          if txt.match(/^\s*\[/)
            current = txt.match(/(?<=").*(?=")/)[0]
            results[current] = {}
          else
            next unless results[current]
            match_data = txt.match(/(\w+)\s*=\s*(.*)/)
            next unless match_data
            target = match_data[2].chomp
            results[current][match_data[1]] = target
            if match_data[1] == "path"
              begin
                results[current]["id"] = blob_content(commit, target)
              rescue InvalidBlobName
                results.delete(current)
              end
            end
          end
        end
        results
      end
def parse_gitmodules ( commit , content ) results = { } current = "" content . split ( "\n" ) . each do | txt | if txt . match ( / ^ \s * \[ / ) current = txt . match ( / (?<=").*(?=") / ) [ 0 ] results [ current ] = { } else next unless results [ current ] match_data = txt . match ( / ( \w +) \s *= \s *(.*) / ) next unless match_data target = match_data [ 2 ] . chomp results [ current ] [ match_data [ 1 ] ] = target if match_data [ 1 ] == "path" begin results [ current ] [ "id" ] = blob_content ( commit , target ) rescue InvalidBlobName results . delete ( current ) end end end end results end
Parses the contents of a .gitmodules file and returns a hash of
submodule information.
Parses the contents of a . gitmodules file and returns a hash of submodule information .
commit
content