Browse Source

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 years ago
parent
commit
03c3ead695
2 changed files with 15 additions and 0 deletions
  1. 14
    0
      dotfiles/bash/global-before.bashrc
  2. 1
    0
      dotfiles/git-universe/disabled-commands

+ 14
- 0
dotfiles/bash/global-before.bashrc View File

4
 ### things to do BEFORE host/user-specific settings ###
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
 ### BASH ###
21
 ### BASH ###
9
 ### '''' ###
22
 ### '''' ###
32
 # make green git bash trinket even cooler
45
 # make green git bash trinket even cooler
33
 export GIT_PS1_SHOWDIRTYSTATE=true
46
 export GIT_PS1_SHOWDIRTYSTATE=true
34
 export GIT_PS1_SHOWUNTRACKEDFILES=true
47
 export GIT_PS1_SHOWUNTRACKEDFILES=true
48
+export GIT_DISABLED_COMMANDS="$HOME/.git-universe/disabled-commands"
35
 
49
 
36
 # disable mounting things like SFTP to ~/.gvfs when accessed
50
 # disable mounting things like SFTP to ~/.gvfs when accessed
37
 # via GIO (used by nautilus etc.)
51
 # via GIO (used by nautilus etc.)

+ 1
- 0
dotfiles/git-universe/disabled-commands View File

1
+am