19 Commits

Author SHA1 Message Date
Mike McQuaid
e07b5a98e0 update-bash: fully resolve Git's path in hash.
Otherwise Bash can cache a relative PATH and then get upset when it
changes directory and cannot find it any more.

Closes Homebrew/homebrew#48493.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-27 10:25:34 +00:00
Martin Afanasjew
da47ca9213 bin/brew: put commands into 'homebrew-' namespace
This should help to avoid collisions with external commands and other
shell functions in the future and is closer to what we do in Ruby, where
commands are namespaced by being methods of the `Homebrew` module.
2016-01-26 16:26:08 +01:00
Martin Afanasjew
aa8329b5a0 update-bash: stop handling command name argument 2016-01-26 16:26:07 +01:00
Martin Afanasjew
6106ac9035 update-bash: discourage direct use
Remove the executable bit from the file to make it clear it is not
supposed to be executed directly. This should make the shebang line and
the early check also unnecessary.
2016-01-26 16:26:07 +01:00
Mike McQuaid
ca8bb1a33c update-bash: release to non-developers.
Allow people to run this command (so we can ask people to test it)
without having to set `HOMEBREW_DEVELOPER`.

Closes Homebrew/homebrew#48260.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-25 16:33:52 +00:00
Xu Cheng
e3687a5ba2 update-bash: use array for QUIET_ARGS
Per @UniqMartin's advice, avoid disabling shellcheck rules.

Closes Homebrew/homebrew#48286.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-21 21:14:55 +08:00
Xu Cheng
e9096b0701 update-bash: explicitly tag local variables 2016-01-21 21:14:55 +08:00
Xu Cheng
eb54a6b5d5 update-bash: handle option flags like -vd
Per @UniqMartin's advice, the original code will fail to handle flags
like `-vd`, because once a case is handled, no other cases are evaluate.
2016-01-21 21:14:55 +08:00
Xu Cheng
58e0249609 update-bash: don't stash for --simulate-from-current-branch
When invoking --simulate-from-current-branch, we shouldn't do any file
manipulation.
2016-01-21 21:14:55 +08:00
Xu Cheng
f7c276a0be update-bash: fix revision variable setting
* only set HOMEBREW_UPDATE_BEFORE inside pull instead of fetch.
* fix HOMEBREW_UPDATE_BEFORE/AFTER variable settings. They should be set
  to INITIAL_REVISION and CURRENT_REVISION correspondingly.
* avoid unnecessary duplicated shellout.
* remove unused variable.
2016-01-21 21:14:55 +08:00
Xu Cheng
2f52ca9ded update-bash: kill all of subprocess on interrupt when fetching 2016-01-21 21:14:55 +08:00
Xu Cheng
2d84fc56fe update-bash: improve reset_on_interrupt
* make sure exit after reset.
* more wide guardian range. We should trap reset_on_interrupt as soon as
  we are about to change any files.
* check INITIAL_BRANCH against UPSTREAM_BRANCH
2016-01-21 21:14:55 +08:00
Xu Cheng
fafe8f0f53 update: implement rename_taps_dir_if_necessary in bash
rename_taps_dir_if_necessary must be performed before actual update.
Otherwise, it will report that `HOMEBREW_UPDAET_BEFORE<REPO_VAR>` is
unset.
2016-01-21 21:14:55 +08:00
Xu Cheng
ca59d6fbee update: improve repo_var
* use HOMEBREW_REPOSITORY instead of HOMEBREW_PREFIX
* better performance:
  * update-bash: avoid shellout
  * update-report: use strip_prefix and tr
* more robust:
  * explicitly handle the case when repo is HOMEBREW_REPOSITORY to avoid
    to handle the trailing backslash.
  * handle both lower case and upper case when stripping non alpha and
    digital characters.
2016-01-21 21:14:55 +08:00
Xu Cheng
9cd2658073 update-bash: avoid shellout for stripping prefix 2016-01-21 21:14:55 +08:00
Xu Cheng
83e1373376 update-bash: use odie and chdir from bin/brew 2016-01-21 21:14:55 +08:00
Xu Cheng
bc78f81032 update-bash: always use [[ 2016-01-21 21:14:55 +08:00
Xu Cheng
bb5cf70a02 update-bash: fix incorrect argument parsing 2016-01-21 21:14:55 +08:00
Mike McQuaid
99234f0256 Add new update-bash command for testing.
This will become the default updater at a later point in the future.
2016-01-17 19:48:02 +00:00