aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/gi/git-cleanup
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-29 12:13:36 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-29 12:15:27 +0100
commit3d8beddc59f052dbd1e17323acf07a847d203bd4 (patch)
treee2f67478cf415a847a733ee8fcfe300c88713e97 /pkgs/by-name/gi/git-cleanup
parentfix(modules/legacy/conf/mail/git-credential-helper): Exit cleanly if password... (diff)
downloadnixos-config-3d8beddc59f052dbd1e17323acf07a847d203bd4.zip
refactor(pkgs/{yti,spodi,git-cleanup,nato,sort_song,virsh-del}): Remove
I have not used one of these commands in the last 8 months.
Diffstat (limited to 'pkgs/by-name/gi/git-cleanup')
-rwxr-xr-xpkgs/by-name/gi/git-cleanup/git-cleanup.sh78
-rw-r--r--pkgs/by-name/gi/git-cleanup/package.nix17
2 files changed, 0 insertions, 95 deletions
diff --git a/pkgs/by-name/gi/git-cleanup/git-cleanup.sh b/pkgs/by-name/gi/git-cleanup/git-cleanup.sh
deleted file mode 100755
index f423a9d2..00000000
--- a/pkgs/by-name/gi/git-cleanup/git-cleanup.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env dash
-
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
-
-help() {
- cat <<EOF
-Automatically remove merged branches (remote and local)
-
-USAGE:
- git-cleanup [OPTIONS]
-
-OPTIONS:
- --remote | -r
- Act on remote branches
-
- --help | -h
- Display this help and exit.
-
- --version | -v
- Display version and copyright information and exit.
-EOF
-}
-
-# This should always be the correct answer.
-get_default_branch() {
- # source: https://stackoverflow.com/a/50056710
- # We assume, that 'origin' is the remote in use
- git remote show origin | sed -n '/HEAD branch/s|.*: ||p'
-}
-
-cleanup() {
- default_branch="$(get_default_branch)"
-
- merged_branches="$(git branch --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)')"
-
- # shellcheck disable=2086
- # We expect the branches to not contain spaces and want git to deal with them
- # separately
- [ "$merged_branches" ] && git branch --delete $merged_branches
-}
-cleanup_remote() {
- default_branch="$(get_default_branch)"
-
- merged_branches="$(git branch --remotes --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)' | sed 's|origin/||')"
-
- # shellcheck disable=2086
- # We expect the branches to not contain spaces and want git to deal with them
- # separately
- [ "$merged_branches" ] && git push --delete origin $merged_branches
-}
-
-remote=false
-for arg in "$@"; do
- case "$arg" in
- "--help" | "-h")
- help
- exit 0
- ;;
- "--version" | "-v")
- version
- exit 0
- ;;
- "--remote" | "-r")
- remote=true
- ;;
- esac
-done
-
-if [ "$remote" = "true" ]; then
- cleanup_remote
-elif [ "$remote" = "false" ]; then
- cleanup
-else
- die "BUG: 'remote' is not true or false but: '$remote'"
-fi
-
-# vim: ft=sh
diff --git a/pkgs/by-name/gi/git-cleanup/package.nix b/pkgs/by-name/gi/git-cleanup/package.nix
deleted file mode 100644
index 54b3f2bd..00000000
--- a/pkgs/by-name/gi/git-cleanup/package.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- sysLib,
- git,
- gnused,
- openssh,
-}:
-sysLib.writeShellScript {
- name = "git-cleanup";
- src = ./git-cleanup.sh;
- keepPath = false;
- generateCompletions = true;
- dependencies = [
- git
- gnused
- openssh
- ];
-}