Skip to content

Commit e44e864

Browse files
author
Sergej Leibenzon
committed
Use -f file checks before sourcing
1 parent bbf3105 commit e44e864

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

hook

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ HAS_NODE=`which node 2> /dev/null || which nodejs 2> /dev/null || which iojs 2>
99
#
1010
# https://answers.atlassian.com/questions/140339/sourcetree-hook-failing-because-paths-don-t-seem-to-be-set-correctly
1111
#
12+
function source_home_file {
13+
file="$HOME/$1"
14+
[[ -f "${file}" ]] && source "${file}"
15+
}
16+
1217
if [[ -z "$HAS_NODE" ]]; then
13-
source ~/.bash_profile || source ~/.zshrc || true
18+
source_home_file ".bash_profile" || source_home_file ".zshrc" || true
1419
fi
1520

1621
NODE=`which node 2> /dev/null`

0 commit comments

Comments
 (0)