From dd7a26e219b3340567aeeececcf383cfdb371fa0 Mon Sep 17 00:00:00 2001 From: Yutian Li Date: Sat, 15 Sep 2018 12:35:48 -0400 Subject: [PATCH 1/4] [git] Also check "commondir" when looking for a stash (#1620) --- modules/git/functions/git-info | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index a173c20f..fe8ca2ac 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -212,10 +212,17 @@ function git-info { # Format stashed. zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' - if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then - stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')" - if [[ -n "$stashed" ]]; then - zformat -f stashed_formatted "$stashed_format" "S:$stashed" + if [[ -n "$stashed_format" ]]; then + commondir="" + if [[ -f "$(git-dir)/commondir" ]]; then + commondir="$(<$(git-dir)/commondir)" + [[ "$commondir" =~ ^/ ]] || commondir="$(git-dir)/$commondir" + fi + if [[ -f "$(git-dir)/refs/stash" || ( -n "$commondir" && -f "$commondir/refs/stash" ) ]]; then + stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')" + if [[ -n "$stashed" ]]; then + zformat -f stashed_formatted "$stashed_format" "S:$stashed" + fi fi fi From 2bbf5d0687bf754fff8ab6fcaec70669907aa29b Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 14 Sep 2018 23:40:08 -0500 Subject: [PATCH 2/4] homebrew: Load standard Homebrew environment variables into shell session. However, guard for legacy Homebrew as `brew shellenv` is relatively new. --- modules/homebrew/README.md | 11 ++++++++++- modules/homebrew/init.zsh | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/homebrew/README.md b/modules/homebrew/README.md index 98a3444c..1a6df51c 100644 --- a/modules/homebrew/README.md +++ b/modules/homebrew/README.md @@ -1,7 +1,16 @@ Homebrew ======== -Defines Homebrew aliases. +Defines Homebrew specific shell environment variables and aliases. + +Environment Variables +--------------------- + +Execute the following to list the environment variables loaded in the shell: + +```sh +brew shellenv +``` Aliases ------- diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index e517c0a5..12acf595 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -10,6 +10,16 @@ if [[ "$OSTYPE" != (darwin|linux)* ]]; then return 1 fi +# +# Environmental Variables +# + +# Load standard Homebrew shellenv into the shell session. +# `brew shellenv` is relatively new, guard for legacy Homebrew. +if (( $+commands[brew] )); then + eval "$(brew shellenv 2> /dev/null)" +fi + # # Aliases # From ad861d3b45190053deba73392b128805f37b06d1 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sat, 15 Sep 2018 01:45:57 -0500 Subject: [PATCH 3/4] homebrew: Replace deprecated casks with their brew counterpart Homebrew has deprecated `brew cask cleanup` and `brew cask search` in favor of `brew cleanup` and `brew search` respectively. They will stop working on 2018-09-30. Further, `--outdated` has been removed. We should eventually remove the related aliases, but for a while we keep supporting them gracefully with deprecation warning. The documentation has been removed from README.md, however. --- modules/homebrew/README.md | 3 --- modules/homebrew/init.zsh | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/homebrew/README.md b/modules/homebrew/README.md index 1a6df51c..3046f98e 100644 --- a/modules/homebrew/README.md +++ b/modules/homebrew/README.md @@ -29,12 +29,9 @@ Aliases ### Homebrew Cask - `cask` is aliased to `brew cask`. - - `caskc` cleans up old cached downloads. - - `caskC` cleans up all cached downloads. - `caski` installs a cask. - `caskl` lists installed casks. - `casko` lists casks which have an update available. - - `casks` searches for a cask. - `caskx` uninstalls a cask. Authors diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index 12acf595..01334473 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -36,10 +36,21 @@ alias brewx='brew remove' # Homebrew Cask alias cask='brew cask' -alias caskc='brew cask cleanup --outdated' -alias caskC='brew cask cleanup' +alias caskc='hb_deprecated brew cask cleanup' +alias caskC='hb_deprecated brew cask cleanup' alias caski='brew cask install' alias caskl='brew cask list' alias casko='brew cask outdated' -alias casks='brew cask search' +alias casks='hb_deprecated brew cask search' alias caskx='brew cask uninstall' + +function hb_deprecated { + local cmd="${argv[3]}" + local cmd_args=( ${(@)argv:4} ) + + printf "'brew cask %s' has been deprecated, " "${cmd}" + printf "using 'brew %s' instead\n" "${cmd}" + + cmd_args=( ${(@)argv:4} ) + command brew "${cmd}" ${(@)cmd_args} +} From f366e49c32727d658160ca4ff2ec6d515ace7aa6 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sat, 15 Sep 2018 01:55:46 -0500 Subject: [PATCH 4/4] homebrew: Cleanup homebrew aliases - 'brew upgrade' does 'brew update' by default, no need for explicit call - replace 'brew remove' with 'brew uninstall' for consistency --- modules/homebrew/init.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index 01334473..cd1e5f72 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -31,8 +31,8 @@ alias brewi='brew install' alias brewl='brew list' alias brewo='brew outdated' alias brews='brew search' -alias brewu='brew update && brew upgrade' -alias brewx='brew remove' +alias brewu='brew upgrade' +alias brewx='brew uninstall' # Homebrew Cask alias cask='brew cask'