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