git: Allow the update script to target non-latest versions
This came in handy when I wanted to bump a patch version while avoiding a new minor version.
This commit is contained in:
parent
36b48140d6
commit
4848eef29d
1 changed files with 4 additions and 3 deletions
|
@ -5,14 +5,15 @@ set -eu -o pipefail
|
|||
|
||||
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion git" | tr -d '"')"
|
||||
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|')"
|
||||
targetVersion="${1:-latestTag}"
|
||||
|
||||
if [ ! "${oldVersion}" = "${latestTag}" ]; then
|
||||
update-source-version git "${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} -> ${latestTag}"
|
||||
git commit -m "git: ${oldVersion} -> ${targetVersion}"
|
||||
else
|
||||
echo "git is already up-to-date"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue