Skip to content

Commit 5e2ff56

Browse files
committed
fetch_git shows an error if git is not installed
1 parent 4859079 commit 5e2ff56

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bin/ruby-build

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,13 @@ fetch_git() {
116116
local git_ref="$3"
117117

118118
echo "Cloning ${git_url}..." >&2
119-
{ git clone --depth 1 --branch "$git_ref" "$git_url" "${package_name}"
120-
} >&4 2>&1
119+
120+
if type git 2>/dev/null; then
121+
git clone --depth 1 --branch "$git_ref" "$git_url" "${package_name}" >&4 2>&1
122+
else
123+
echo "error: please install \`git\` and try again" >&2
124+
exit 1
125+
fi
121126
}
122127

123128
build_package() {

0 commit comments

Comments
 (0)