summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTara Bass <tara.bass@gusto.com>2025-02-27 11:44:50 -0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-03-10 12:43:36 +0900
commit4323674fe4d697db48856292deb459f9ca923272 (patch)
treeec11a46abcd3cccff5ba4e7c146e65e785931fe9 /lib
parent71e340881f1aca4911a35ddafd519fb0e29e6544 (diff)
[rubygems/rubygems] Don't treat a git-sourced gem install as complete if only the '.git' directory is present. This recovers cases where a git-sourced install can be left in a partially installed state.
https://github.com/rubygems/rubygems/commit/d132b7008d
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12890
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/source/git.rb6
-rw-r--r--lib/bundler/source/git/git_proxy.rb6
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index fde05e472b..d57944ee12 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -360,7 +360,11 @@ module Bundler
end
def locked_revision_checked_out?
- locked_revision && locked_revision == revision && install_path.exist?
+ locked_revision && locked_revision == revision && installed?
+ end
+
+ def installed?
+ git_proxy.installed_to?(install_path)
end
def base_name
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index a73e893829..e01c5876de 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -147,6 +147,12 @@ module Bundler
end
end
+ def installed_to?(destination)
+ # if copy_to is interrupted, it may leave a partially installed directory that
+ # contains .git but no other files -- consider this not to be installed
+ Dir.exist?(destination) && (Dir.children(destination) - [".git"]).any?
+ end
+
private
def git_remote_fetch(args)