diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-05-31 19:19:56 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-31 19:19:56 +0300 |
commit | ea7269e4c66a51eb4c66b9022ba4c2b35d8ad012 (patch) | |
tree | 3157bd820270d37619ae290b028e915673f5eceb /lib | |
parent | 0c7dd30c78043ea3d4629e1e5739ccfcc7d968fe (diff) |
Remove entry variable
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/repository.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index c3bf32ca1cc..9d6adbdb4ac 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1006,40 +1006,39 @@ module Gitlab # Parses the contents of a .gitmodules file and returns a hash of # submodule information. def parse_gitmodules(commit, content) - results = {} + modules = {} name = nil - entry = nil content.each_line do |line| case line.strip when /\A\[submodule "(?<name>[^"]+)"\]\z/ # Submodule header name = $~[:name] - entry = results[name] = {} + modules[name] = {} when /\A(?<key>\w+)\s*=\s*(?<value>.*)\z/ # Key/value pair key = $~[:key] value = $~[:value].chomp - next unless name && entry + next unless name && modules[name] - entry[key] = value + modules[name][key] = value if key == 'path' begin - entry['id'] = blob_content(commit, value) + modules[name]['id'] = blob_content(commit, value) rescue InvalidBlobName # The current entry is invalid - results.delete(name) - name = entry = nil + modules.delete(name) + name = nil end end when /\A#/ # Comment next else # Invalid line - name = entry = nil + name = nil end end - results + modules end # Returns true if +commit+ introduced changes to +path+, using commit |