1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p curl common-updater-scripts jq git 3 4set -eu -o pipefail 5 6oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion git" | tr -d '"')" 7latestTag="$(git ls-remote --tags --sort="v:refname" https://github.com/git/git.git | grep -v '{}' | grep -v '\-rc' | tail -1 | sed 's|^.*/v\(.*\)|\1|')" 8targetVersion="${1:-$latestTag}" 9 10if [ ! "${oldVersion}" = "${targetVersion}" ]; then 11 update-source-version git "${targetVersion}" 12 nixpkgs="$(git rev-parse --show-toplevel)" 13 default_nix="$nixpkgs/pkgs/applications/version-management/git/default.nix" 14 nix-build -A git 15 git add "${default_nix}" 16 git commit -m "git: ${oldVersion} -> ${targetVersion}" 17else 18 echo "git is already up-to-date" 19fi