]> git.phdru.name Git - dotfiles.git/commitdiff
.shellrc: Fix `cdremote`: Skip branch without upstream
authorOleg Broytman <phd@phdru.name>
Sun, 18 Aug 2019 18:19:19 +0000 (21:19 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 18 Aug 2019 18:19:19 +0000 (21:19 +0300)
.shellrc

index 1920ed7cc94ddc04b34ea6cc17341ef70f1a4865..513431d56037a9e60c7e5774e003ec8f67957160 100644 (file)
--- 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