Skip to content

Commit fd36fc0

Browse files
authored
Merge pull request #787 from rvbuelow/patch-1
Use GIT_DIR environment variable to to set .git directory
2 parents eb9ddbe + 256044c commit fd36fc0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bin/git-ignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
: ${GIT_DIR:=.git}
4+
35
function show_contents {
46
local file="${2/#~/$HOME}"
57
if [ -f "$file" ]; then
@@ -37,13 +39,13 @@ function add_local {
3739

3840
function show_private {
3941
cd "$(git root)"
40-
show_contents Private .git/info/exclude
42+
show_contents Private "${GIT_DIR}/info/exclude"
4143
}
4244

4345
function add_private {
4446
cd "$(git root)"
45-
test -d .git/info || mkdir -p .git/info
46-
add_patterns .git/info/exclude "$@"
47+
test -d "${GIT_DIR}/info" || mkdir -p "${GIT_DIR}/info"
48+
add_patterns "${GIT_DIR}/info/exclude" "$@"
4749
}
4850

4951
function add_patterns {

0 commit comments

Comments
 (0)