Skip to content

Commit

Permalink
Merge pull request #44 from SergeL/source-also-zshrc
Browse files Browse the repository at this point in the history
Source .zshrc when .bash_profile isn't available
  • Loading branch information
3rd-Eden committed Sep 30, 2015
2 parents 886496a + e44e864 commit 273c805
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hook
Expand Up @@ -4,12 +4,18 @@ HAS_NODE=`which node 2> /dev/null || which nodejs 2> /dev/null || which iojs 2>

#
# There are some issues with Source Tree because paths are not set correctly for
# the given environment. Sourcing the bash_profile seems to resolve this for users
# the given environment. Sourcing the bash_profile seems to resolve this for bash users,
# sourcing the zshrc for zshell users.
#
# https://answers.atlassian.com/questions/140339/sourcetree-hook-failing-because-paths-don-t-seem-to-be-set-correctly
#
if [ -z "$HAS_NODE" ] && [ -f ~/.bash_profile ]; then
source ~/.bash_profile
function source_home_file {
file="$HOME/$1"
[[ -f "${file}" ]] && source "${file}"
}

if [[ -z "$HAS_NODE" ]]; then
source_home_file ".bash_profile" || source_home_file ".zshrc" || true
fi

NODE=`which node 2> /dev/null`
Expand Down

0 comments on commit 273c805

Please sign in to comment.