Skip to content
This repository

github plugin: only alias git=hub if `hub --version` works. #717

Merged
merged 1 commit into from about 2 years ago

2 participants

Daniel Hahler Robby Russell
Daniel Hahler

hub is crashing for me on a old CentOS setup with
"undefined method `shelljoin'".

On first use of the git function it is now checked if
hub --version returns successfully.

Daniel Hahler Only alias git=hub if `hub --version` works.
`hub` is crashing for me on a old CentOS setup with
"undefined method `shelljoin'".

On first use of the `git` function it is now checked if
`hub --version` returns successfully.
2c660c1
Robby Russell robbyrussell merged commit 80257bd into from
Robby Russell robbyrussell closed this
Robby Russell robbyrussell merged commit 2c660c1 into from
Robby Russell robbyrussell closed this
Michele Campeotto micampe referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 24, 2011
Daniel Hahler Only alias git=hub if `hub --version` works.
`hub` is crashing for me on a old CentOS setup with
"undefined method `shelljoin'".

On first use of the `git` function it is now checked if
`hub --version` returns successfully.
2c660c1
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. 12  plugins/github/github.plugin.zsh
12  plugins/github/github.plugin.zsh
... ...
@@ -1,7 +1,17 @@
1 1
 # Setup hub function for git, if it is available; http://github.com/defunkt/hub
2 2
 if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
3 3
     # eval `hub alias -s zsh`
4  
-    function git(){hub "$@"}
  4
+    function git(){
  5
+        if ! (( $+_has_working_hub  )); then
  6
+            hub --version &> /dev/null
  7
+            _has_working_hub=$(($? == 0))
  8
+        fi
  9
+        if (( $_has_working_hub )) ; then
  10
+            hub "$@"
  11
+        else
  12
+            command git "$@"
  13
+        fi
  14
+    }
5 15
 fi
6 16
 
7 17
 # Functions #################################################################
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.