diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-10-04 14:13:52 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-10-04 14:13:52 -0400 |
commit | 3606a1488952008426b1be870e62804b22fe8a61 (patch) | |
tree | 6893f6b0cc6cb51b202ffb8d822107dc733d8585 /lib/extracts_path.rb | |
parent | e25ddca0c462522703af93822863023f4a754390 (diff) | |
download | gitlab-ce-3606a1488952008426b1be870e62804b22fe8a61.tar.gz |
ExtractsPath: Use ref_names instead of branches+tags
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r-- | lib/extracts_path.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index 020ff5cdf14..b60dfd036e1 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -57,16 +57,16 @@ module ExtractsPath # Append a trailing slash if we only get a ref and no file path id = input id += '/' unless id.ends_with?('/') - - valid_refs = @project.branches + @project.tags - valid_refs.select! { |v| id.start_with?("#{v.name}/") } - + + valid_refs = @project.ref_names + valid_refs.select! { |v| id.start_with?("#{v}/") } + if valid_refs.length != 1 # No exact ref match, so just try our best pair = id.match(/([^\/]+)(.*)/).captures else # Partition the string into the ref and the path, ignoring the empty first value - pair = id.partition(valid_refs.first.name)[1..-1] + pair = id.partition(valid_refs.first)[1..-1] end end |