Skip to content

Commit

Permalink
Fix incorrect error message on Windows
Browse files Browse the repository at this point in the history
We're parsing the exception message here looking for a path, but we were
not considering potential drive letters on Windows.
  • Loading branch information
deivid-rodriguez committed Oct 27, 2020
1 parent 45b5a70 commit 001fede
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source/git/git_proxy.rb
Expand Up @@ -118,7 +118,7 @@ def copy_to(destination, submodules = false)
git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
rescue Errno::EEXIST => e
file_path = e.message[%r{.*?(/.*)}, 1]
file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
raise GitError, "Bundler could not install a gem because it needs to " \
"create a directory, but a file exists - #{file_path}. Please delete " \
"this file and try again."
Expand Down
2 changes: 0 additions & 2 deletions bundler/spec/install/gemfile/git_spec.rb
Expand Up @@ -933,8 +933,6 @@
end

it "prints a friendly error if a file blocks the git repo" do
skip "drive letter is not detected correctly in error message" if Gem.win_platform?

build_git "foo"

FileUtils.mkdir_p(default_bundle_path)
Expand Down

0 comments on commit 001fede

Please sign in to comment.