浏览代码

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 年前
父节点
当前提交
03c3ead695
共有 2 个文件被更改,包括 15 次插入0 次删除
  1. 14
    0
      dotfiles/bash/global-before.bashrc
  2. 1
    0
      dotfiles/git-universe/disabled-commands

+ 14
- 0
dotfiles/bash/global-before.bashrc 查看文件

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 查看文件

1
+am