From: Oleg Broytman Date: Sun, 18 Aug 2019 18:19:19 +0000 (+0300) Subject: .shellrc: Fix `cdremote`: Skip branch without upstream X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=49085342eddc71906df583beacafd855d2caca90;p=dotfiles.git .shellrc: Fix `cdremote`: Skip branch without upstream --- diff --git a/.shellrc b/.shellrc index 1920ed7..513431d 100644 --- a/.shellrc +++ b/.shellrc @@ -220,13 +220,7 @@ if test -x /usr/bin/git >/dev/null 2>&1; then remote="$1" fi - if [ -z "$remote" ]; then - echo "Cannot find remote for branch $branch" >&2 - echo "Usage: cdremote [remote_name]" >&2 - return 1 - fi - - if git config --get remote.$remote.url | grep -q '^\(file:/\|/\|\.\./\)'; then + if [ -n "$remote" ] && git config --get remote.$remote.url | grep -q '^\(file:/\|/\|\.\./\)'; then cdgitpath remote.$remote.url else