-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·37 lines (29 loc) · 1.04 KB
/
uninstall.sh
File metadata and controls
executable file
·37 lines (29 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=/dev/null
source "$ROOT_DIR/scripts/lib.sh"
on_err_trap
enable_xtrace_if_debug
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
HOOK_DIR="$XDG_CONFIG_HOME/git/hooks"
STATE_DIR="$XDG_CONFIG_HOME/caulking"
PREV_HOOKSPATH_FILE="$STATE_DIR/previous_hookspath"
need_cmd git
info "Removing installed hooks from: $HOOK_DIR"
rm -f "$HOOK_DIR/pre-commit" "$HOOK_DIR/pre-push" "$HOOK_DIR/commit-msg" || true
if [[ -f "$PREV_HOOKSPATH_FILE" ]]; then
prev="$(cat "$PREV_HOOKSPATH_FILE" || true)"
if [[ -n "$prev" ]]; then
info "Restoring previous core.hooksPath: $prev"
git config --global core.hooksPath "$prev"
else
info "Previous core.hooksPath was empty; unsetting"
git config --global --unset core.hooksPath || true
fi
else
info "No previous core.hooksPath recorded; unsetting"
git config --global --unset core.hooksPath || true
fi
info "Uninstall complete."
info "Note: global gitleaks config is left in place."