Ver código fonte

Added ability to disable git commands entirely

Especially useful because of the dangetous git-am behavior and its
short name (easily confused with my often used alias `am`).
Alois Mahdal 11 anos atrás
pai
commit
03c3ead695

+ 14
- 0
dotfiles/bash/global-before.bashrc Ver arquivo

@@ -4,6 +4,19 @@
4 4
 ### things to do BEFORE host/user-specific settings ###
5 5
 #######################################################
6 6
 
7
+### .... ###
8
+### SUBZ ###
9
+### '''' ###
10
+
11
+git() {
12
+    if grep -Fwqs "$1" "$GIT_DISABLED_COMMANDS"; then
13
+        echo "You don't want this." >&2
14
+        return 1
15
+    else
16
+        command git "$@"
17
+    fi
18
+}
19
+
7 20
 ### .... ###
8 21
 ### BASH ###
9 22
 ### '''' ###
@@ -32,6 +45,7 @@ export GREP_OPTIONS="--color --binary-files=without-match"
32 45
 # make green git bash trinket even cooler
33 46
 export GIT_PS1_SHOWDIRTYSTATE=true
34 47
 export GIT_PS1_SHOWUNTRACKEDFILES=true
48
+export GIT_DISABLED_COMMANDS="$HOME/.git-universe/disabled-commands"
35 49
 
36 50
 # disable mounting things like SFTP to ~/.gvfs when accessed
37 51
 # via GIO (used by nautilus etc.)

+ 1
- 0
dotfiles/git-universe/disabled-commands Ver arquivo

@@ -0,0 +1 @@
1
+am