From f7eba55589c7af76539f7532f16f077a29c9a26b Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Mon, 30 Dec 2024 23:09:49 +0100 Subject: [PATCH] fetchFromGitLab: passthru `rev` based on `tag` --- pkgs/build-support/fetchgitlab/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/fetchgitlab/default.nix b/pkgs/build-support/fetchgitlab/default.nix index aef76270d5ec..c060352d1a9f 100644 --- a/pkgs/build-support/fetchgitlab/default.nix +++ b/pkgs/build-support/fetchgitlab/default.nix @@ -37,10 +37,9 @@ lib.makeOverridable ( repo ] ); + revWithTag = if tag != null then "refs/tags/" + tag else rev; escapedSlug = lib.replaceStrings [ "." "/" ] [ "%2E" "%2F" ] slug; - escapedRev = lib.replaceStrings [ "+" "%" "/" ] [ "%2B" "%25" "%2F" ] ( - if tag != null then "refs/tags/" + tag else rev - ); + escapedRevWithTag = lib.replaceStrings [ "+" "%" "/" ] [ "%2B" "%25" "%2F" ] revWithTag; passthruAttrs = removeAttrs args [ "protocol" "domain" @@ -77,7 +76,7 @@ lib.makeOverridable ( } else { - url = "${protocol}://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRev}"; + url = "${protocol}://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRevWithTag}"; passthru = { inherit gitRepoUrl; @@ -95,9 +94,9 @@ lib.makeOverridable ( meta.homepage = "${protocol}://${domain}/${slug}/"; inherit tag - rev owner repo ; + rev = revWithTag; } )