Skip to content

Conversation

@Edouard-chin
Copy link
Contributor

What was the end-user or developer problem that led to this PR?

Fix #9186

What is your fix for the problem, implemented in this PR?

Running bundle pristine in a Gemfile where there is many git gem pointing to the same repository will result in a error "Another git process seems to be running in this repository".

Context

This error is a regression since a555fd6 where bundle pristine now runs in parallel which could lead to running simultaneous git operations in the same repository.

Solution

When Bundler pristine a git gem it does a git reset --hard without specifying a path. This means the whole repository will be reset. In this case, we can leverage that by just pristining one gem per unique git sources. This is also more efficient.

git "reset", "--hard", @revision, dir: destination

Make sure the following tasks are checked

- Fix ruby#9186
- ### Problem

  Running `bundle pristine` in a Gemfile where there is many git gem
  pointing to the same repository will result in a error
  "Another git process seems to be running in this repository".

  ### Context

  This error is a regression since a555fd6
  where `bundle pristine` now runs in parallel which could lead
  to running simultaneous git operations in the same repository.

  ### Solution

  When Bundler pristine a git gem it does a `git reset --hard` without
  specifying a path.
  This means the whole repository will be reset. In this case, we can
  leverage that by just pristining one gem per unique git sources.
  This is also more efficient.
Copy link
Member

@hsbt hsbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@hsbt hsbt merged commit 92af20c into ruby:master Dec 16, 2025
81 checks passed
hsbt added a commit that referenced this pull request Dec 16, 2025
Allow bundle pristine to work for git gems in the same repo

(cherry picked from commit 92af20c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundler pristine consistently fails on multiple gems referencing same repo

2 participants