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

Already on GitHub? Sign in to your account

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

Closed
cpasillas opened this Issue Mar 30, 2011 · 2 comments

Comments

Projects
None yet
3 participants

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

Contributor

robertwahler commented Aug 18, 2011

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

carlhuda#1358

-robert

indirect added a commit that referenced this issue Sep 13, 2011

Merge pull request #1358 from robertwahler/bundler
---

This fixes issue #1105, Gemfile.lock always updated on Windows
when running bundle install

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

@mscottford mscottford closed this Feb 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment