2019-04-07 14:10:49 +01:00
|
|
|
#!/usr/bin/env nix-shell
|
2019-12-10 13:30:00 +00:00
|
|
|
#!nix-shell -i bash -p curl common-updater-scripts jq git
|
2019-04-07 14:10:49 +01:00
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2019-11-24 17:22:28 +00:00
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion git" | tr -d '"')"
|
2019-04-07 14:10:49 +01:00
|
|
|
latestTag="$(git ls-remote --tags --sort="v:refname" git://github.com/git/git.git | grep -v '\{\}' | grep -v '\-rc' | tail -1 | sed 's|^.*/v\(.*\)|\1|')"
|
2020-04-15 07:06:10 +01:00
|
|
|
targetVersion="${1:-latestTag}"
|
2019-04-07 14:10:49 +01:00
|
|
|
|
2020-04-15 07:06:10 +01:00
|
|
|
if [ ! "${oldVersion}" = "${targetVersion}" ]; then
|
|
|
|
update-source-version git "${targetVersion}"
|
2019-04-07 14:10:49 +01:00
|
|
|
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}"
|
2020-04-15 07:06:10 +01:00
|
|
|
git commit -m "git: ${oldVersion} -> ${targetVersion}"
|
2019-04-07 14:10:49 +01:00
|
|
|
else
|
|
|
|
echo "git is already up-to-date"
|
|
|
|
fi
|