Merge pull request #119610 from attila-lendvai/updater

unstable-updater.nix now understands a branch argument
This commit is contained in:
Sandro 2021-06-18 11:30:31 +02:00 committed by GitHub
commit 2685bda657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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')"