Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Fetch git sources with --force
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Apr 12, 2010
1 parent 8a7382a commit be5796e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def cache_path
def cache
if cached?
Bundler.ui.info "Updating #{uri}"
in_cache { git %|fetch --quiet "#{uri}" refs/heads/*:refs/heads/*| }
in_cache { git %|fetch --force --quiet "#{uri}" refs/heads/*:refs/heads/*| }
else
Bundler.ui.info "Fetching #{uri}"
FileUtils.mkdir_p(cache_path.dirname)
Expand All @@ -363,7 +363,7 @@ def checkout
git %|clone --no-checkout "#{cache_path}" "#{path}"|
end
Dir.chdir(path) do
git "fetch --quiet"
git "fetch --force --quiet"
git "reset --hard #{revision}"
end
end
Expand Down
22 changes: 22 additions & 0 deletions spec/install/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,28 @@
out.should match(/run `bundle install`/i)
end

it "handles repos that have been force-pushed" do
build_git "forced", "1.0"
install_gemfile <<-G
git "#{lib_path('forced-1.0')}"
gem 'forced'
G
should_be_installed "forced 1.0"


update_git "forced" do |s|
s.write "lib/forced.rb", "FORCED = '1.1'"
end
bundle :install
should_be_installed "forced 1.1"

Dir.chdir(lib_path('forced-1.0')) do
`git reset --hard head^`
end
bundle :install
should_be_installed "forced 1.0"
end

it "handles long gem names and full shas with C extensions" do
build_git "some_gem_with_a_really_stupidly_long_name_argh" do |s|
s.executables = "stupid"
Expand Down

0 comments on commit be5796e

Please sign in to comment.