diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-25 18:13:25 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-25 18:13:25 +0200 |
commit | ad9a652748a364565001a0aee0a20596526ba6d2 (patch) | |
tree | 8f52dd87667651057fd920a0460ad23219e84f70 /pkgs | |
parent | fix(yambar): Correctly specify the `yambar-{cpu,memory}` binaries (diff) | |
download | nixos-config-ad9a652748a364565001a0aee0a20596526ba6d2.tar.gz nixos-config-ad9a652748a364565001a0aee0a20596526ba6d2.zip |
chore(version): v1.38.0
Diffstat (limited to 'pkgs')
-rwxr-xr-x | pkgs/by-name/gi/git-cleanup/git-cleanup.sh | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/pkgs/by-name/gi/git-cleanup/git-cleanup.sh b/pkgs/by-name/gi/git-cleanup/git-cleanup.sh index 1ab7bbd1..a6d8805a 100755 --- a/pkgs/by-name/gi/git-cleanup/git-cleanup.sh +++ b/pkgs/by-name/gi/git-cleanup/git-cleanup.sh @@ -4,7 +4,7 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH help() { - cat << EOF + cat <<EOF Automatically remove merged branches (remote and local) USAGE: @@ -30,48 +30,43 @@ get_default_branch() { } cleanup() { - default_branch="$(get_default_branch)"; + default_branch="$(get_default_branch)" - merged_branches="$(git branch --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)')"; + merged_branches="$(git branch --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)')" [ "$merged_branches" ] && git branch --delete "$merged_branches" } cleanup_remote() { - default_branch="$(get_default_branch)"; + default_branch="$(get_default_branch)" - merged_branches="$(git branch --remotes --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)' | sed 's|origin/||')"; + merged_branches="$(git branch --remotes --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)' | sed 's|origin/||')" [ "$merged_branches" ] && git push --delete origin "$merged_branches" } - - -remote=false; +remote=false for arg in "$@"; do case "$arg" in - "--help" | "-h") - help; - exit 0; - ;; - "--version" | "-v") - version; - exit 0; - ;; - "--remote" | "-r") - remote=true; - ;; + "--help" | "-h") + help + exit 0 + ;; + "--version" | "-v") + version + exit 0 + ;; + "--remote" | "-r") + remote=true + ;; esac done - - - if [ "$remote" = "true" ]; then - cleanup_remote; + cleanup_remote elif [ "$remote" = "false" ]; then - cleanup; + cleanup else - die "BUG: 'remote' is not true or false but: '$remote'"; + die "BUG: 'remote' is not true or false but: '$remote'" fi # vim: ft=sh |