aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rwxr-xr-xlibexec/build-fetch-git14
1 files changed, 14 insertions, 0 deletions
diff --git a/libexec/build-fetch-git b/libexec/build-fetch-git
index 92c7962..5017f98 100755
--- a/libexec/build-fetch-git
+++ b/libexec/build-fetch-git
@@ -6,10 +6,12 @@ build_fetch_git()
build_fetch_git_uri="${build_fetch_git_uri#git://}"
build_fetch_git_uri="${build_fetch_git_uri%%\?*}"
build_fetch_git_tag=
+ build_fetch_git_commit=
build_fetch_git_var=
for arg in $(build-url --arg "${1}"); do
case "${arg}" in
(archive=*) build_fetch_git_var="${arg##*=}";;
+ (commit=*) build_fetch_git_commit="${arg##*=}";;
(*) build_fetch_git_tag="${arg}";;
esac
done
@@ -60,6 +62,18 @@ build_fetch_git()
fi
;;
esac
+ elif [ ! -z "${build_fetch_git_commit}" ]; then
+ if ! git clone "${build_fetch_git_uri}" "${build_fetch_git_dir}"; then
+ die "failed to clone git source at '${build_fetch_git_uri}'"
+ fi
+
+ if ! cd "${build_fetch_git_dir}"; then
+ die "failed to change working directory to '${build_fetch_git_dir}'"
+ fi
+
+ if ! git checkout "${build_fetch_git_commit}"; then
+ die "failed to checkout git commit '${build_fetch_git_commit}'"
+ fi
else
if ! git clone --depth 1 "${build_fetch_git_uri}" "${build_fetch_git_dir}"; then
die "failed to clone git source at '${build_fetch_git_uri}'"