102 Commits

Author SHA1 Message Date
Jack Haden-Enneking
e63feb79f9
Simplify check before git install
No need to check for both variables, because they're always set together.
Also, this harmonizes with the CURL equivalent just above.
2018-06-26 11:14:32 -07:00
Jack Haden-Enneking
9fd5a92ff6 Implement HOMEBREW_FORCE_BREWED_GIT
Because of this messing with the user's path:
https://github.com/Homebrew/brew/blob/
    efc02899c851c62c9ce0d15dea9a231575d7d774/bin/brew#L68
brew uses /usr/bin/git over brewed git, even when the former is
problematically old.
There may also be other reasons a user prefers to use brewed git.

There was already a HOMEBREW_FORCE_BREWED_CURL option and a
HOMEBREW_SYSTEM_CURL_TOO_OLD check to set it. This mostly copies those
to implement HOMEBREW_FORCE_BREWED_GIT & HOMEBREW_SYSTEM_GIT_TOO_OLD.

See also: https://github.com/Linuxbrew/brew/issues/736
2018-06-25 23:36:12 -07:00
Eli Young
8734848829 Support enabling auto-updates for non-GitHub taps 2018-04-24 11:10:48 -07:00
Mike McQuaid
70a9a67411 Don't use Linuxbrew/homebrew-core (yet, at least).
This can't be tapped on vanilla Homebrew/brew because things like e.g.
`GlibcRequirement` are missing. We will put this back when the Linuxbrew
to Homebrew migration is complete.
2018-03-16 19:30:18 +00:00
Mike McQuaid
430bb7c3a0 update: tweak git too old check.
Avoid trying to install and warning if system Git is too old but Git
is already installed.
2018-02-27 10:41:16 +00:00
Mike McQuaid
72f4d05418 Handle a too old system Git on OS X 10.8 and below
Needed for GitHub since:
https://github.com/blog/2507-weak-cryptographic-standards-removed
2018-02-26 16:08:10 +00:00
ilovezfs
17f80a44e6
Revert "Use Homebrew's gitconfig for various commands" 2018-01-15 07:30:56 +00:00
Mike McQuaid
228cbd81c9 Use Homebrew's gitconfig for various commands
Git is a transport and storage mechanism for us so we don't want to
allow arbitrary customisation of this due to user issues e.g. #3664
and #3561.

Fixes #3664.
2018-01-11 20:40:59 +00:00
Mike McQuaid
6b9ca5dbf5 Remove some unset/checked environment checks
These will be redundant once environment filtering is on by default
in #3529.
2017-12-08 16:33:33 +00:00
Mike McQuaid
a19d0708a4 Allow optionally using Homebrew's curl
If `HOMEBREW_FORCE_BREWED_CURL` is set then allow it to be used instead
of the system `curl`.
2017-11-26 18:17:26 +00:00
Mike McQuaid
bcca2a7c6b brew: handle Ruby 2.3 more gracefully.
- `brew.rb` needed updated to fail unless on Ruby 2.3
- `brew update` should unset `HOMEBREW_RUBY_PATH` to ensure that this
  doesn't "stick" on a Ruby 2.0 version after a portable Ruby has been
  installed.
2017-09-29 19:53:50 +01:00
Mike McQuaid
ffdda0eb9f Tweaks for older Mac OS X versions.
- `brew update` should try to install `curl` before `git` on older
  versions of Mac OS X where it is needed for accessing modern SSL
  certificates.
- We don't need an HTTP mirror for `git` because `curl` will already be
  installed before it is downloaded.
- Don't recommend GCC on Mac OS X versions where it can't be built with
  the default system compiler.
- Start using the Homebrew `curl` on Mac OS X versions where it is
  needed as soon as it is installed.
2017-09-16 12:41:08 +01:00
Tim Marinin
156e19c6dc Display "Use brew upgrade foo instead" when calling update with args
So the user could just copy-paste the command.
2017-07-10 12:30:58 +03:00
Mike McQuaid
228239af31 Allow forcing Homebrew GitHub organisation.
On Linux this defaults to Linuxbrew but in some cases (i.e. a Linux
machine performing uploads for Homebrew) we want to allow this to be
overridden back to the defaults.

Relies on a change incoming to `brew test-bot` to set this there.
2017-04-25 09:13:36 +01:00
Mike McQuaid
566d3cb58b Document all short flags. 2017-04-02 10:14:58 +01:00
Mike McQuaid
282622e449 update: stop autoupdate skipping no formula taps.
This will be slightly slower if you have a bunch of non-formula (i.e.
command or cask) taps but it avoids the confusion of having Homebrew
saying it's updated when it only did so selectively.

Fixes #1946.
2017-03-12 09:13:27 +00:00
Mike McQuaid
276d8805ca update: note migrations may be performed.
As requested in https://github.com/Homebrew/homebrew-core/issues/9316.
2017-01-29 17:30:44 +00:00
Baptiste Fontaine
bff8e8440e update.sh: Use full path to pkill
Fixes #1600.
2016-12-01 20:59:42 +01:00
Mike McQuaid
d4311fd49f update.sh: use sort instead of git tag --sort.
Older versions of Git don't have this flag and we don't want to block
updates for them when there's a (relatively) simple workaround.
2016-09-29 09:16:15 +01:00
Mike McQuaid
2c50f762ce update.sh: hide GITHUB_HEADERS missing output.
Will only happen once but could be confusing anyway.
2016-09-27 13:55:08 +01:00
Mike McQuaid
f6ec63cd8b update.sh: don't restore branch to stable.
Only run for Homebrew developers so assume they don’t want to switch
back to an old stable branch.

Fixes #1141.
2016-09-26 08:22:56 +01:00
Mike McQuaid
1ff2d06cf0 update.sh: use HOMEBREW_UPDATE_TO_TAG.
This makes the code easier to follow rather than having to know
HOMEBREW_NO_UPDATE_CLEANUP implies not updating to a tag.
2016-09-25 21:53:28 +01:00
Mike McQuaid
87cf4f7f7a update.sh: use GitHub tags API.
Otherwise if we've committed to `master` and someone `brew update`s
before we cut the tag then they won't be updated to the latest version.
2016-09-24 20:43:14 +01:00
Mike McQuaid
2f82837b77 Merge pull request #1121 from MikeMcQuaid/update-stable-branch
update.sh: always use stable branch for tags.
2016-09-24 18:59:10 +01:00
Mike McQuaid
22299cffab update.sh: always use stable branch for tags.
This avoids creating a new branch that’ll never be deleted for each tag
and differentiates between the `master` and `stable` branches.
2016-09-24 17:25:15 +01:00
Zhiming Wang
07866f0b54
update.sh: do not restore stable (tag) branch
Restoring stable branch post-update could lead to unsuspecting users
with homebrew.devcmdrun being stuck forever on an old tag.

Fixes #1111.
2016-09-24 05:49:04 -04:00
Mike McQuaid
b0dfd2d435 update.sh: only update to semver tags.
Otherwise random e.g. `pr-123` tags may cause `brew update` to update
to the wrong version.
2016-09-23 11:26:24 +01:00
Mike McQuaid
b33df4d0fa update.sh: don't print "checkout branch" message.
It’ll only get printed for people getting updated to tags now and these
are people who haven’t run a `dev-cmd` so we want to air on the side of
telling them less stuff that will confuse them and assume people who
have manually made another `git` branch will know how to get back to it.
2016-09-22 09:05:07 +01:00
Mike McQuaid
f9bd121e38 update.sh: tweak tag handling.
- Don't let the `UPSTREAM_TAG` variable bleed into future repository
  checks.
- Even if the tag branch is an ancestor of the tag ensure that it's
  forced back to the tag anyway.
2016-09-21 14:32:48 +01:00
Mike McQuaid
e8ebcb834b update.sh: allow forcing tag update.
To test the tag update functionality allow setting
`HOMEBREW_UPDATE_TO_TAG`.
2016-09-21 09:03:52 +01:00
Mike McQuaid
b2c7d6d83d update.sh: update to latest Homebrew/brew tag.
Rather than following every change on `master` let’s have non-developer
users (i.e. those who have never run a `dev-cmd` or set
`HOMEBREW_DEVELOPER`) update between tags.

This provides a fairly natural beta (the `master` branch`) and stable
(the tags) approach without restricting us to any particular way of
managing our tags.
2016-09-21 09:03:51 +01:00
Mike McQuaid
9623272283 update.sh: force a full update if we have no tags. 2016-09-20 17:16:47 +01:00
Mike McQuaid
d62512095f update.sh: always fetch tags.
We use these for updating people who just follow tags.
2016-09-20 17:16:47 +01:00
Mike McQuaid
3f9cce0a03 Use new "macOS" naming where appropriate.
Not quite a mass replacement as I've used OS X and Mac OS X where
describing specific older versions and added compatibility methods
for things in the DSL.
2016-09-18 19:57:19 +01:00
Mike McQuaid
d70841db2b update.sh: turn origin/branch into a variable.
Rather than repeating origin multiple times.
2016-09-18 13:45:32 +01:00
Mike McQuaid
8aa18510c4 Always run LinkedKegs migration (if needed).
Ensure that `brew update` always runs the LinkedKegs migration if needed
as it may not have been run by `brew update` if it was using `--preinstall` or
a `git pull` etc.

Also, if the old paths still exist: just use them instead.

Finally, always try to unlink/unpin before link/pin.

Fixes https://github.com/Homebrew/homebrew-core/issues/4918.
2016-09-17 13:25:32 +01:00
Mike McQuaid
b5a6b4e8e1 Merge pull request #896 from MikeMcQuaid/no-chown-usr-local
Don't require/recommend ownership of /usr/local.
2016-09-09 09:29:46 +01:00
Mike McQuaid
492391f5fe Don't require/recommend ownership of /usr/local.
Apple reset this on every OS X major (and some minor) updates and it
always proves a painful and unnecessary step. Instead just check the
directories we actually care about are writable.

This may mean if these directories do not already exist (although they
are now created by the installed) that `brew link` will fail and require
manual intervention but this seems to be superior for both new and the
majority of existing users.
2016-09-09 08:06:37 +01:00
Mike McQuaid
691d57f594 update.sh: don't cleanup on update for developers.
We’re defining developers as people who have run a dev-cmd at least
once.
2016-09-08 20:46:36 +01:00
Alyssa Ross
04ebd0af33 Adjust branch change message 2016-09-05 22:18:24 +01:00
Alyssa Ross
07a00c234c Warn when changing branch on update
Closes #877
2016-09-05 11:20:19 +01:00
Mike McQuaid
6622b565ee Merge pull request #801 from MikeMcQuaid/git-shim-realpath
scm/git: make --homebrew=print-path use realpath.
2016-09-01 07:46:58 +01:00
Mike McQuaid
46a3003a2f update.sh: reset pre-stash, die if stash fails.
A `git reset --hard` without stashing first risks nuking in-progress
work. A `git reset --mixed` should allow stashing to occur more often
on e.g. merge conflicts.

Fixes #766.
2016-08-25 11:45:59 +01:00
Mike McQuaid
ea069936bf Revert "update: make GIT_EXECUTABLE an absolute path."
This reverts commit b6afa228f4974f4af1e8938911e35150aa2991c8 from #778.
2016-08-25 11:12:22 +01:00
Mike McQuaid
b6afa228f4 update: make GIT_EXECUTABLE an absolute path.
Otherwise it can end up as e.g. `bin/git` which then breaks when we
`cd` to another directory and try to run it.
2016-08-22 09:04:15 +01:00
Martin Afanasjew
823505a058 Fix minor issues in command help text formatting
- Inconsistent or unneeded indentation
- Missing or superfluous empty lines
- Missing or wrongly formatted arguments in command summary
- Missing punctuation
2016-08-17 01:25:51 +02:00
Mike McQuaid
611ba62a24 Merge pull request #689 from MikeMcQuaid/update-force
update: add --force argument.
2016-08-14 10:00:06 +01:00
Mike McQuaid
24fb0068e7 update: add --force argument.
Add a `brew update --force` to side-step all of the clever optimisations
we have to detect if an update is unnecessary. That means if those
optimisations go wrong in future we can tell people just to run this
single command.

This would have been a useful workaround for the issue fixed in 985c672.
2016-08-12 14:22:00 +01:00
Mike McQuaid
99837fae47 update.sh: prevent overwriting UPSTREAM_BRANCH.
UPSTREAM_BRANCH was being used both as a loop variable name and name
for the upstream branch for HOMEBREW_REPOSITORY. This meant that the
variable names were overwritten which prevented update.

Closes #693.
2016-08-11 17:22:27 +01:00
Mike McQuaid
24b5db5367 update.sh: further tweak update fix. 2016-08-11 13:47:13 +01:00