-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix bundle outdated
crashing when both ref
and branch
specified for a git gem in Gemfile
#6959
Fix bundle outdated
crashing when both ref
and branch
specified for a git gem in Gemfile
#6959
Conversation
22d7f4c
to
dbc1ce6
Compare
let(:revision) { nil } | ||
let(:git_source) { nil } | ||
let(:clone_result) { double(Process::Status, :success? => true) } | ||
let(:base_clone_args) { ["clone", "--bare", "--no-hardlinks", "--quiet", "--no-tags", "--depth", "1", "--single-branch"] } | ||
subject { described_class.new(path, uri, ref, revision, git_source) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the signature for GitProxy.new
is not followed here, sending 'HEAD'
as ref
instead of the actual expected 3rd argument of options
as a Hash
. This is the case for all tests in this file, clearly indicating that these tests did zero testing of any options
. It was working only because of ducky handling:
>> opt = "HEAD"
=> "HEAD"
>> opt["tag"]
=> nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Thank you for this. I had made a quick pass at flipping the order, saw that not one single test failed, and decided I would have to come back to it. Thanks for taking the time to increase the test coverage and make more than zero tests cover this behavior, and for raising the error when the nonsensical is given.
By the way, I'm fine with the multiple unrelated commits. We just won't squash this when we merge it so the commit messages can stay coupled to their changes even though they are not themselves related. It would also be fine to make separate PRs with each of them. |
91213e3
to
0f47ea6
Compare
- Specs for GitProxy were incorrect and insufficient - Specs are now correct and less insufficient
0f47ea6
to
2851e05
Compare
Rebased on latest upstream/master |
bundle outdated
crashing when both ref
and branch
specified for a git gem in Gemfile
bundle outdated
crashing when both ref
and branch
specified for a git gem in Gemfilebundle outdated
crashing when both ref
and branch
specified for a git gem in Gemfile
(cherry picked from commit c2c0966)
(cherry picked from commit c2c0966)
Fixes #6951 to honor
ref
>branch
. This in turn fixesbundle outdated
for Gemfiles with dependencies specifying bothbranch
andref
.Also:
ref
orbranch
are specified withtag
, as that's an ambiguous state.What was the end-user or developer problem that led to this PR?
branch
andref
on a git source, some bundler commands break (e.g.bundle outdated
see bundle outdated uses incorrect git command when branch and ref specified #6951)branch
had higher precedence thanref
, which is incorrect.tag
was in betweenbranch
andref
in precedence, which doesn't make any sense, and in fact,tag
should never be specified withbranch
orref
, as it creates an ambiguous reference that has until now been arbitrarily decided by the code in bundler (should it be the tag, or the branch/ref?).What is your fix for the problem, implemented in this PR?
This implementation raises an error, and I expect it can affect users who unwittingly specified ambiguous references in their Gemfile, but for whom
bundle
commands currently work. As such this might be considered a breaking change, but it is also definitely a bugfix. In many cases this would only affect users for whom the bundle / git commands are already broken, such as the case in #6951.Make sure the following tasks are checked