about summary refs log tree commit diff
path: root/pkgs/applications/version-management/git/update.sh
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@protonmail.com>2022-12-19 08:46:57 -0300
committerAndersonTorres <torres.anderson.85@protonmail.com>2022-12-19 15:05:22 -0300
commitd994dabacef6a7e13a41d144cd6d800f8e21a11f (patch)
tree04bf3d99d27800b95686feef4000e7794e2df375 /pkgs/applications/version-management/git/update.sh
parentb10a520017ac319c1e57b07742efd2bcc918d160 (diff)
treewide: remove git-and-tools directory
We do not use a "plugin system" for Git addons anymore, and therefore this
directory is no longer useful. Indeed that directory is way more confusing,
given that it includes more than mere Git addons, going from Bitbucket server
command-line tools to complete rewrites of Git in exotic programming languages.

Also, without this directory, the mental load of decision-making reduces a lot.
When anyone is interested in including a new git-related tool, just put it into
pkgs/applications/version-management, without apologies.
Diffstat (limited to 'pkgs/applications/version-management/git/update.sh')
-rwxr-xr-xpkgs/applications/version-management/git/update.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/applications/version-management/git/update.sh b/pkgs/applications/version-management/git/update.sh
new file mode 100755
index 0000000000000..54574722b02b7
--- /dev/null
+++ b/pkgs/applications/version-management/git/update.sh
@@ -0,0 +1,19 @@
+#!/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