From a570f4b7f332d6a1f7b25e1d5fd9a3954e379065 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Thu, 11 Jun 2015 11:04:54 +0200 Subject: [PATCH 1/6] git plugin: bring back olg gg aliases by popular demand, see #3972 --- plugins/git/git.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index e42e0968..28227dcb 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -104,11 +104,15 @@ ggl() { git pull origin "${b:=$1}" } compdef _git ggl=git-checkout +alias ggpull='ggl' +compdef _git ggpull=git-checkout ggp() { [[ "$#" != 1 ]] && b="$(current_branch)" git push origin "${b:=$1}" } compdef _git ggp=git-checkout +alias ggpush='ggp' +compdef _git ggpush=git-checkout ggpnp() { ggl "$1" && ggp "$1" } @@ -119,6 +123,8 @@ ggu() { git pull --rebase origin "${b:=$1}" } compdef _git ggu=git-checkout +alias ggpur='ggu' +compdef _git ggpur=git-checkout alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' From 6c29041af73fc3668f6a3256ebc7ab532a2bbba9 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Thu, 11 Jun 2015 15:12:28 +0200 Subject: [PATCH 2/6] git plugin: global var for git command due to issues like #3962 until a proper plugin-loading system is implemented --- plugins/git/git.plugin.zsh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 28227dcb..154a7bb9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,7 +1,6 @@ # Query/use custom command for `git`. -local git_cmd -zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd -: ${git_cmd:=git} +zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd +: ${_omz_git_git_cmd:=git} # # Functions @@ -13,20 +12,20 @@ zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd # it's not a symbolic ref, but in a Git repo. function current_branch() { local ref - ref=$($git_cmd symbolic-ref --quiet HEAD 2> /dev/null) + ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null) local ret=$? if [[ $ret != 0 ]]; then [[ $ret == 128 ]] && return # no git repo. - ref=$($git_cmd rev-parse --short HEAD 2> /dev/null) || return + ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return fi echo ${ref#refs/heads/} } # The list of remotes function current_repository() { - if ! $git_cmd rev-parse --is-inside-work-tree &> /dev/null; then + if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then return fi - echo $($git_cmd remote -v | cut -d':' -f 2) + echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2) } # Pretty log messages function _git_log_prettily(){ From 6ff96dab36865ab208b08a004903338bfd405eac Mon Sep 17 00:00:00 2001 From: ncanceill Date: Thu, 11 Jun 2015 16:16:12 +0200 Subject: [PATCH 3/6] git plugin: fix error msg in gwip alias because git rm will fail when no files were deleted --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 154a7bb9..7db43351 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -204,4 +204,4 @@ alias gupv='git pull --rebase -v' alias gvt='git verify-tag' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted); git commit -m "--wip--"' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"' From f513999a4dbfea3a15287368848a718543fcaf7b Mon Sep 17 00:00:00 2001 From: ncanceill Date: Thu, 11 Jun 2015 17:14:35 +0200 Subject: [PATCH 4/6] git plugin: make b local in gg* functions because it leaked, and led to #3991 --- plugins/git/git.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 7db43351..dec787a8 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -94,19 +94,19 @@ alias gfo='git fetch origin' alias gg='git gui citool' alias gga='git gui citool --amend' ggf() { -[[ "$#" != 1 ]] && b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(current_branch)" git push --force origin "${b:=$1}" } compdef _git ggf=git-checkout ggl() { -[[ "$#" != 1 ]] && b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(current_branch)" git pull origin "${b:=$1}" } compdef _git ggl=git-checkout alias ggpull='ggl' compdef _git ggpull=git-checkout ggp() { -[[ "$#" != 1 ]] && b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(current_branch)" git push origin "${b:=$1}" } compdef _git ggp=git-checkout @@ -118,7 +118,7 @@ ggl "$1" && ggp "$1" compdef _git ggpnp=git-checkout alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' ggu() { -[[ "$#" != 1 ]] && b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(current_branch)" git pull --rebase origin "${b:=$1}" } compdef _git ggu=git-checkout From 8eb31a6f9a053ea22ea88ccba3d91a4694674300 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Thu, 11 Jun 2015 23:34:18 +0200 Subject: [PATCH 5/6] git plugin: fix ggpnp when called without argument also allow multiple arguments for ggp and ggl aliases --- plugins/git/git.plugin.zsh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index dec787a8..5cceb8d2 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -99,21 +99,29 @@ git push --force origin "${b:=$1}" } compdef _git ggf=git-checkout ggl() { -[[ "$#" != 1 ]] && local b="$(current_branch)" -git pull origin "${b:=$1}" +[[ "$#" == 0 ]] && local b="$(current_branch)" +git pull origin "${b:=$1}" "${*[2,-1]}" } compdef _git ggl=git-checkout alias ggpull='ggl' compdef _git ggpull=git-checkout ggp() { -[[ "$#" != 1 ]] && local b="$(current_branch)" +if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then +git push origin "${*}" +else +[[ "$#" == 0 ]] && local b="$(current_branch)" git push origin "${b:=$1}" +fi } compdef _git ggp=git-checkout alias ggpush='ggp' compdef _git ggpush=git-checkout ggpnp() { -ggl "$1" && ggp "$1" +if [[ "$#" == 0 ]]; then +ggl && ggp +else +ggl "${*}" && ggp "${*}" +fi } compdef _git ggpnp=git-checkout alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' From f1a43daa36efdbf5c75dbc07927310b25259a114 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 12 Jun 2015 11:50:30 +0200 Subject: [PATCH 6/6] =?UTF-8?q?git=20plugin:=20new/changed=20aliases=20gaa?= =?UTF-8?q?=20was=20brought=20back=20by=20popular=20demand=20=E2=80=94=20s?= =?UTF-8?q?ee=20#3535=20gap=20was=20replaced=20with=20gapa=20=E2=80=94=20s?= =?UTF-8?q?ee=20#3682=20gdc=20was=20replaced=20with=20gdca=20=E2=80=94=20s?= =?UTF-8?q?ee=20#3977?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/git/git.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5cceb8d2..d59e0ca9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -48,6 +48,8 @@ function work_in_progress() { alias g='git' alias ga='git add' +alias gaa='git add --all' +alias gapa='git add --patch' alias gb='git branch' alias gba='git branch -a' @@ -79,7 +81,7 @@ alias gcp='git cherry-pick' alias gcs='git commit -S' alias gd='git diff' -alias gdc='git diff --cached' +alias gdca='git diff --cached' alias gdt='git diff-tree --no-commit-id --name-only -r' gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff