Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Gemfile.lock created in Unix is always updated on Windows when running bundle install #1105

Closed
cpasillas opened this Issue · 2 comments

3 participants

@cpasillas

When a Gemfile.lock created in Unix (with Unix-style line endings) is used in Windows, Bundler will always attempt to update Gemfile.lock such that it includes Windows line endings, even if there are no actual changes to make to the file.

Here's where the issue is:
definition.rb checks the Gemfile.lock contents with Windows line-endings against the contents of the file which (as I said) already has Unix line endings.

The code to convert windows line endings to Unix endings only runs after the files are compared. I'm not sure if this would cause other problems, but as far as I can tell, this would fix it:
Move this:
# Convert to \r\n if the existing lock has them
# i.e., Windows with git config core.autocrlf=true
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")

Above this:
return if @lockfile_contents == contents

@robertwahler robertwahler referenced this issue from a commit
@robertwahler robertwahler Gemfile.lock should not be touched if nothing has changed
This fixes issue #1105, Gemfile.lock always updated on Windows
when running bundle install
dc15dc5
@robertwahler

Good catch. Thanks. I've added failing specs and your fix to this pull request:

#1358

-robert

@mscottford
Collaborator

Closing since there's a merged pull request that claims to fix this issue.

@mscottford mscottford closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.