unstable-updater.nix now understands a branch argument

This commit is contained in:
Attila Lendvai 2021-04-16 14:22:13 +02:00
parent 068b26fa11
commit 6c876bac61
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,5 @@
{ writeShellScript
{ lib
, writeShellScript
, coreutils
, git
, nix
@ -8,6 +9,7 @@
# This is an updater for unstable packages that should always use the latest
# commit.
{ url ? null # The git url, if empty it will be set to src.url
, branch ? null
}:
let
@ -25,7 +27,9 @@ let
# Get info about HEAD from a shallow git clone
tmpdir="$(${coreutils}/bin/mktemp -d)"
${git}/bin/git clone --bare --depth=1 "$url" "$tmpdir"
${git}/bin/git clone --bare --depth=1 \
${lib.optionalString (branch != null) "--branch ${branch}"} \
"$url" "$tmpdir"
pushd "$tmpdir"
commit_date="$(${git}/bin/git show -s --pretty='format:%cs')"
commit_sha="$(${git}/bin/git show -s --pretty='format:%H')"