Skip to content

Commit

Permalink
Add support for ref: in gem.deps.rb.lock for git
Browse files Browse the repository at this point in the history
This support was omitted.  The ref: doesn't seem to do anything useful
in bundler (its only fetched for an equality comparison) so it is
ignored here.

Bug rubygems#822
  • Loading branch information
drbrain committed Apr 7, 2014
1 parent 29f9fd0 commit 56aa22c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions History.txt
Expand Up @@ -39,6 +39,8 @@ Bug fixes:
now. Bug #821 by johnny5-.
* Gem dependency API supports lockfiles without explicit sources. Bug #820 by
johnny5-.
* Gem dependency API supports lockfiles with git sources using ref. Bug #822
by johnny5-.
* SSL configuration entries in ~/.gemrc are properly round-tripped. Bug #837
by Noah Luck Easterly.
* The environment command now shows the system configuration directory where
Expand Down
7 changes: 7 additions & 0 deletions lib/rubygems/request_set/lockfile.rb
Expand Up @@ -341,6 +341,13 @@ def parse_GIT # :nodoc:

skip :newline

if [:entry, 'ref'] == peek.first(2) then
get
get :text

skip :newline
end

get :entry, 'specs'

skip :newline
Expand Down
43 changes: 43 additions & 0 deletions test/rubygems/test_gem_request_set_lockfile.rb
Expand Up @@ -200,6 +200,49 @@ def test_parse_GIT
assert_equal %w[a-2], git_set.specs.values.map { |s| s.full_name }

assert_equal [dep('b', '>= 3')], git_set.specs.values.first.dependencies

expected = {
'a' => %w[git://example/a.git master],
}

assert_equal expected, git_set.repositories
end

def test_parse_GIT_ref
write_lockfile <<-LOCKFILE
GIT
remote: git://example/a.git
revision: 1234abc
ref: 1234abc
specs:
a (2)
b (>= 3)
DEPENDENCIES
a!
LOCKFILE

@lockfile.parse

assert_equal [dep('a', '= 2')], @set.dependencies

lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end

refute lockfile_set, 'fount a LockSet'

git_set = @set.sets.find do |set|
Gem::Resolver::GitSet === set
end

assert git_set, 'could not find a GitSet'

expected = {
'a' => %w[git://example/a.git 1234abc],
}

assert_equal expected, git_set.repositories
end

def test_parse_PATH
Expand Down

0 comments on commit 56aa22c

Please sign in to comment.