mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 10:43:27 +00:00
666042141e
The syntax is ${parameter:-word} (i.e. previously this used "latestTag" instead of the actual value). (Fixes a regression from #85278.) Also: Even though getting the latest tag isn't really security critical (as long as Git itself is secure against untrusted input), I'd prefer to switch from the Git to the HTTPS protocol (for authentication of the server and encryption + uses a standard port).
20 lines
772 B
Bash
Executable File
20 lines
772 B
Bash
Executable File
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p curl common-updater-scripts jq git
|
|
|
|
set -eu -o pipefail
|
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion git" | tr -d '"')"
|
|
latestTag="$(git ls-remote --tags --sort="v:refname" https://github.com/git/git.git | grep -v '\{\}' | grep -v '\-rc' | tail -1 | sed 's|^.*/v\(.*\)|\1|')"
|
|
targetVersion="${1:-$latestTag}"
|
|
|
|
if [ ! "${oldVersion}" = "${targetVersion}" ]; then
|
|
update-source-version git "${targetVersion}"
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
default_nix="$nixpkgs/pkgs/applications/version-management/git-and-tools/git/default.nix"
|
|
nix-build -A git
|
|
git add "${default_nix}"
|
|
git commit -m "git: ${oldVersion} -> ${targetVersion}"
|
|
else
|
|
echo "git is already up-to-date"
|
|
fi
|