From 2e484b74f685646a34173e9fbf71b09c0b63323d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Tue, 9 Nov 2021 17:00:07 -0500 Subject: git: fix upstream command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fatal: argumento ambiguo '@{upstream}...HEAD': revisión desconocida o ruta fuera del árbol de trabajo. Use '--' para separar las rutas de las revisiones, de esta manera: 'git [...] -- [...]' fatal: argumento ambiguo '@{upstream}...HEAD': revisión desconocida o ruta fuera del árbol de trabajo. Use '--' para separar las rutas de las revisiones, de esta manera: 'git [...] -- [...]' --- hyperterm/core/git.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'hyperterm/core/git.sh') diff --git a/hyperterm/core/git.sh b/hyperterm/core/git.sh index f008d84..1488a93 100644 --- a/hyperterm/core/git.sh +++ b/hyperterm/core/git.sh @@ -146,14 +146,9 @@ function _git_dirty_count() { fi } -function _git_upstream() { - ___upstream="$(git rev-parse --symbolic-full-name --abbrev-ref "@{upstream}" 2> /dev/null)" -} - function _git_behind_count() { local __behind_count - _git_upstream - if [[ -n $___upstream ]]; then + if git rev-parse --symbolic-full-name --abbrev-ref "@{upstream}" > /dev/null 2>&1; then __behind_count="$(git rev-list --left-right --count "$___upstream"...HEAD | cut -f1 2> /dev/null)" case $__behind_count in 0) echo -n '';; @@ -164,8 +159,7 @@ function _git_behind_count() { function _git_ahead_count() { local __ahead_count - _git_upstream - if [[ -n $___upstream ]]; then + if git rev-parse --symbolic-full-name --abbrev-ref "@{upstream}" > /dev/null 2>&1; then __ahead_count="$(git rev-list --left-right --count "$___upstream"...HEAD | cut -f2 2> /dev/null)" case $__ahead_count in 0) echo -n '';; -- cgit v1.2.3