Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore better error message when locked ref does not exist #6356

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

deivid-rodriguez
Copy link
Member

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

When user tries to install a Gemfile.lock file that includes a locked reference that does not exist, it will get a verbose and not too helpful error.

$ bundle install
Fetching gem metadata from https://rubygems.org/.
Fetching https://github.com/dependabot-fixtures/prius

Retrying `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` at /Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281 due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` in directory /Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281 has failed.
fatal: remote error: upload-pack: not our ref cff701b3bfb182afc99a85657d7c9f3d6c1ccce1

Retrying `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` at /Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281 due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` in directory /Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281 has failed.
fatal: remote error: upload-pack: not our ref cff701b3bfb182afc99a85657d7c9f3d6c1ccce1

Retrying `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` at /Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281 due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` in directory /Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281 has failed.
fatal: remote error: upload-pack: not our ref cff701b3bfb182afc99a85657d7c9f3d6c1ccce1

Git error: command `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius
cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` in directory
/Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281
has failed.
fatal: remote error: upload-pack: not our ref cff701b3bfb182afc99a85657d7c9f3d6c1ccce1

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

My fix is to restore the kind of error Bundler 2.3 used to give:

$ bundle install
Fetching gem metadata from https://rubygems.org/.
Fetching https://github.com/dependabot-fixtures/prius

Git error: command `git fetch --force --quiet --no-tags --unshallow -- https://github.com/dependabot-fixtures/prius
cff701b3bfb182afc99a85657d7c9f3d6c1ccce1:refs/cff701b3bfb182afc99a85657d7c9f3d6c1ccce1-sha` in directory
/Users/deivid/Code/dependabot/dependabot-core/bundler/spec/fixtures/projects/bundler2/bad_ref/foo/ruby/3.2.0/cache/bundler/git/prius-17ebc9a1c48915a50268b9922f2901ebf171d281
has failed.
Revision cff701b3bfb182afc99a85657d7c9f3d6c1ccce1 does not exist in the repository https://github.com/dependabot-fixtures/prius. Maybe you misspelled it?

Make sure the following tasks are checked

@deivid-rodriguez deivid-rodriguez merged commit 584ac4c into master Feb 10, 2023
@deivid-rodriguez deivid-rodriguez deleted the better-error-on-bad-ref branch February 10, 2023 20:35
deivid-rodriguez added a commit that referenced this pull request Feb 15, 2023
Restore better error message when locked ref does not exist

(cherry picked from commit 584ac4c)
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.

None yet

1 participant