vendor: Fix ohmyzsh git plugin so it can be sourced

pull/1831/head
Noah Gorny 2021-09-17 14:45:16 +03:00
parent 9257d6b46d
commit a25a822d0f
1 changed files with 3 additions and 14 deletions

View File

@ -1,7 +1,3 @@
# Git version checking
autoload -Uz is-at-least
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
#
# Functions
#
@ -20,7 +16,6 @@ function _git_log_prettily(){
git log --pretty=$1
fi
}
compdef _git _git_log_prettily=git-log
# Warn if the current branch is a WIP
function work_in_progress() {
@ -125,10 +120,10 @@ alias gdw='git diff --word-diff'
function gdnolock() {
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
}
compdef _git gdnolock=git-diff
function gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
function gdv() {
git diff -w "$@" | view -
}
alias gf='git fetch'
# --jobs=<n> was added in git 2.8
@ -146,12 +141,10 @@ function ggf() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force origin "${b:=$1}"
}
compdef _git ggf=git-checkout
function ggfl() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force-with-lease origin "${b:=$1}"
}
compdef _git ggfl=git-checkout
function ggl() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
@ -161,7 +154,6 @@ function ggl() {
git pull origin "${b:=$1}"
fi
}
compdef _git ggl=git-checkout
function ggp() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
@ -171,7 +163,6 @@ function ggp() {
git push origin "${b:=$1}"
fi
}
compdef _git ggp=git-checkout
function ggpnp() {
if [[ "$#" == 0 ]]; then
@ -180,13 +171,11 @@ function ggpnp() {
ggl "${*}" && ggp "${*}"
fi
}
compdef _git ggpnp=git-checkout
function ggu() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git pull --rebase origin "${b:=$1}"
}
compdef _git ggu=git-checkout
alias ggpur='ggu'
alias ggpull='git pull origin "$(git_current_branch)"'