aboutsummaryrefslogtreecommitdiff
path: root/libexec/build-fetch-git
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2016-11-07 22:02:34 -0600
committerDavid Barksdale <amatus@amatus.name>2016-11-07 22:02:34 -0600
commitc49154cb9b0f5d60e174b4dfb98f37cb2f5f080b (patch)
tree3eeeef0bb60605f67104600343f49514b3068bad /libexec/build-fetch-git
parent011f99247294db206e973b7070bcea119a7727f2 (diff)
Support commit= in git URLsHEADmaster
Diffstat (limited to 'libexec/build-fetch-git')
-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}'"