update: disable git line ending conversion
If a user has set core.autocrlf = true (which shouldn't ever be used on OS X, but alas...), a subsequent `brew update` will check out files with CRLF line endings. Setting core.autocrlf = false in Homebrew's repo config will override this global setting, and let us check out files with their in-repository line endings. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
caa3c4f864
commit
28d6a0f4de
@ -29,6 +29,9 @@ class RefreshBrew
|
|||||||
# Performs an update of the homebrew source. Returns +true+ if a newer
|
# Performs an update of the homebrew source. Returns +true+ if a newer
|
||||||
# version was available, +false+ if already up-to-date.
|
# version was available, +false+ if already up-to-date.
|
||||||
def update_from_masterbrew!
|
def update_from_masterbrew!
|
||||||
|
# ensure GIT_CONFIG is unset as we need to operate on .git/config
|
||||||
|
ENV.delete('GIT_CONFIG')
|
||||||
|
|
||||||
HOMEBREW_REPOSITORY.cd do
|
HOMEBREW_REPOSITORY.cd do
|
||||||
if git_repo?
|
if git_repo?
|
||||||
safe_system "git checkout -q master"
|
safe_system "git checkout -q master"
|
||||||
@ -41,6 +44,7 @@ class RefreshBrew
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
safe_system "git init"
|
safe_system "git init"
|
||||||
|
safe_system "git config core.autocrlf false"
|
||||||
safe_system "git remote add origin #{REPOSITORY_URL}"
|
safe_system "git remote add origin #{REPOSITORY_URL}"
|
||||||
safe_system "git fetch origin"
|
safe_system "git fetch origin"
|
||||||
safe_system "git reset --hard origin/master"
|
safe_system "git reset --hard origin/master"
|
||||||
@ -50,6 +54,8 @@ class RefreshBrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ensure we don't munge line endings on checkout
|
||||||
|
safe_system "git config core.autocrlf false"
|
||||||
# specify a refspec so that 'origin/master' gets updated
|
# specify a refspec so that 'origin/master' gets updated
|
||||||
refspec = "refs/heads/master:refs/remotes/origin/master"
|
refspec = "refs/heads/master:refs/remotes/origin/master"
|
||||||
rebase = "--rebase" if ARGV.include? "--rebase"
|
rebase = "--rebase" if ARGV.include? "--rebase"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user