summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOPNA2608 <opna2608@protonmail.com>2024-02-07 16:46:56 +0100
committerOPNA2608 <opna2608@protonmail.com>2024-03-03 18:58:58 +0100
commit3cd4a35e710230c2e19838a4f45c555280e66e14 (patch)
tree2767be9380ac48ba94db59e83b41a8372be95476
parent460374eb04229b5e5ed2bb4a9ddaf76cecef3717 (diff)
unstableGitUpdater: Try full history if failed to find any tags in shallow clone
-rw-r--r--pkgs/common-updater/unstable-updater.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/pkgs/common-updater/unstable-updater.nix b/pkgs/common-updater/unstable-updater.nix
index 2d63a250aa64..91047e685531 100644
--- a/pkgs/common-updater/unstable-updater.nix
+++ b/pkgs/common-updater/unstable-updater.nix
@@ -90,19 +90,20 @@ let
${git}/bin/git fetch --depth="$depth" --tags
depth=$(( $depth * 2 ))
done
+
+ if [[ -z "$last_tag" ]]; then
+ # To be extra sure, check if full history helps with finding a tag
+ git fetch --tags
+ last_tag="$(${git}/bin/git describe --tags --abbrev=0 2> /dev/null || true)"
+ fi
else
- last_tag="$(${git}/bin/git describe --tags --abbrev=0 2> /dev/null || true)"
+ last_tag="$(${git}/bin/git describe --tags --abbrev=0 2> /dev/null || true)"
fi
if [[ -z "$last_tag" ]]; then
- if [[ "$shallow_clone" == "1" ]]; then
- echo "Cound not find a tag within last 10000 commits" > /dev/stderr
- else
- echo "Cound not find a tag" > /dev/stderr
- fi
- exit 1
+ last_tag="0"
fi
if [[ -n "$tag_prefix" ]]; then
- last_tag="''${last_tag#$tag_prefix}"
+ last_tag="''${last_tag#$tag_prefix}"
fi
if [[ ! "$last_tag" =~ ^[[:digit:]] ]]; then
echo "Last tag '$last_tag' (after removing prefix '$tag_prefix') does not start with a digit" > /dev/stderr