225 Commits

Author SHA1 Message Date
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
Mike McQuaid
985c672bac update.sh: check upstream SHA prefetch not local.
Otherwise this can prevent taps from being updated as expected.
2016-08-11 10:59:35 +01:00
Mike McQuaid
0c6e307eef update.sh: all configurable HOMEBREW_AUTO_UPDATE_SECS. 2016-08-10 15:37:04 +01:00
Mike McQuaid
1a240cd52a Tweak HOMEBREW_NO_AUTO_UPDATE handling.
This can just live in `brew.sh` and then it doesn’t need repeated in
all the other places.
2016-08-10 15:37:04 +01:00
Mike McQuaid
11116c2467 update.sh: further speed up brew update.
Tweak the logic further to make the no-op case even faster.

Before:
```
brew update  1.10s user 1.05s system 92% cpu 2.325 total
brew update --preinstall  0.60s user 0.77s system 96% cpu 1.433 total
```

After:
```
brew update  0.60s user 0.34s system 83% cpu 1.132 total
brew update --preinstall  0.29s user 0.24s system 62% cpu 0.860 total
```

These times are now fast enough to avoid any further special-casing for
`--preinstall`, roll it out to users by default and not print a message
unless we've actually found some updates.
2016-08-10 15:37:04 +01:00
Martin Afanasjew
159b0eea35 update: suppress warning about missing FETCH_HEAD
Fixes #671.
2016-08-09 21:19:30 +02:00
Mike McQuaid
2b8ea07979 update: don't recheck taps checked in the last 1m.
This is less than ideal but it gets the time on my machine down from ~6s
to ~2s when checking no taps. It still shows that we're doing way more
in `update.sh` than we need to be doing but that's a future PR.
2016-08-09 13:44:43 +01:00
Martin Afanasjew
1e9328c6e1 cmd/update.sh: fix style inconsistencies 2016-08-08 16:00:12 +02:00
AnastasiaSulyagina
be5484da8c update-report: allow Casks migration to formulae.
Closes #588.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-08-02 11:45:47 +01:00
Mike McQuaid
0d0519d48d update.sh: fix Git path.
Closes https://github.com/Homebrew/brew/issues/519
Closes https://github.com/Homebrew/homebrew-core/issues/3029
2016-07-15 19:38:27 +01:00
Mike McQuaid
a07ab8bb92 brew.{rb,sh}: move to Library/Homebrew. (#506) 2016-07-15 19:33:30 +01:00
Mike McQuaid
a02be9eea2 ENV: move to new paths. (#507)
Move some stuff formerly in `Library/ENV` around:
- Move `Library/ENV/$XCODE_VERSION` to `Library/Homebrew/env/super` as they are
  all superenv wrappers and all symlinks to the same version. We never needed
  the "separate shims for separate versions" functionality and it just adds
  confusion.
- Move `Library/ENV/pkgconfig` to `Library/Homebrew/env/pkgconfig` to get more
  things under `Library/Homebrew`
- Move `Library/ENV/scm` to `Library/scm` as these wrappers are not actually
  used by or related to superenv (or stdenv) in any way.
2016-07-15 19:03:45 +01:00
Xu Cheng
c2ece46e1b
various: don't assume non-OS X == Linux. 2016-07-14 15:41:09 +08:00
Xu Cheng
43a962a5cd update: git init for core tap as well (#510)
A temporary measure before we decide whether vendor git or not.
2016-07-14 15:39:05 +08:00
Mike McQuaid
ed1d1e51da update.sh: improve verbose output and readability. (#486)
Would have made it easier to debug
https://github.com/Homebrew/homebrew-core/issues/2804 where wasn't clear which
directory was causing the issue.
2016-07-12 19:45:49 +01:00
Dominyk Tiller
1022bcff06
update: mimic doctor permissions advice
We might as well be consistent about it, since it's not obvious to people
what the next step is after we've pointed out the directory isn't writable.

Fixes #476.
2016-07-10 12:41:08 +01:00
Mike McQuaid
86b1df96b9 Autoupdate tweaks (#442)
* Don't infinitely recurse `brew update --preinstall`.

This could happen when trying to `brew install git` inside `brew update
--preinstall`.

* update.sh: cache Git PATH.

We don’t need to look it up from superenv every time; this is slow.

* update.sh: print message before preinstall updates.

* update.sh: verbose output fetch directory.

This aids reading `brew update --verbose --debug` output.

* update.sh: skip taps without formulae on preinstall.

We don’t need to update them as we’re not invoking them.

* update.sh: don't force update-report on developer preinstall.

This is too slow.
2016-07-07 10:24:37 +01:00
Martin Afanasjew
d4f5f0cec7 brew.sh: rename 'chdir' to 'safe_cd'
This is inspired by `safe_system` with basically the same implication
(fail on error), making the name a lot less confusing and avoiding a
clash with the `chdir` function previously defined in `bin/brew`.

Closes #414.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-06-29 13:38:50 +02:00
Mike McQuaid
62dd4b14ba update.sh: quieten checkout. 2016-06-16 10:57:46 +01:00
Mike McQuaid
e1f0dec41e update.sh: developers always run update-report.
As they may use e.g. `git pull` which may result in them having formulae
that aren't migrated (and they mind less about the slight slowdown).
2016-06-12 18:28:08 +02:00
ilovezfs
2cd81e5051 update: pop the stash more quietly
git stash pop -q will print "Already up-to-date!" if untracked changes
are being poppped. This quiets it down unless verbose is set.

Closes #320.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-06-05 07:55:35 -07:00
Mike McQuaid
8a217dd420 update: tweak stash/checkout behavior. (#312)
Always pop stashed changes for Homebrew developers and only checkout
original branches for them (to avoid users who don't understand Git
ending up "stuck" on branches).
2016-06-03 14:12:36 +01:00
Xu Cheng
77836cfb3f fix shellcheck complaint 2016-05-13 14:41:29 +08:00
Xu Cheng
6eb2287221 move git shell function to brew.sh
git is also used in analytics.sh
2016-05-13 14:40:14 +08:00
Xu Cheng
92934db202 move brew shell function to brew.sh 2016-05-13 14:37:18 +08:00
Xu Cheng
1b6a200809 update: use lock
Closes #181.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-05-12 15:36:46 +08:00
Martin Afanasjew
500f9eada8 update: fix hyphen counting (legacy tap renaming)
Fix regression introduced in fafe8f0f53bf91fc41f016b5c2af41ca712783f7.
Counting the number of hyphens in a string cannot be done in a single
expression, thus split this and introduce another local variable.

Fixes #227.
2016-05-09 21:00:26 +02:00
Martin Afanasjew
93e0f4f946 update: remove stray comma (legacy tap renaming)
Fix regression introduced in fafe8f0f53bf91fc41f016b5c2af41ca712783f7.
2016-05-09 21:00:09 +02:00