Merge pull request #787 from rvbuelow/patch-1

Use GIT_DIR environment variable to to set .git directory
This commit is contained in:
罗泽轩 2019-10-02 19:23:08 +08:00 committed by GitHub
commit fd36fc0ea2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
: ${GIT_DIR:=.git}
function show_contents {
local file="${2/#~/$HOME}"
if [ -f "$file" ]; then
@ -37,13 +39,13 @@ function add_local {
function show_private {
cd "$(git root)"
show_contents Private .git/info/exclude
show_contents Private "${GIT_DIR}/info/exclude"
}
function add_private {
cd "$(git root)"
test -d .git/info || mkdir -p .git/info
add_patterns .git/info/exclude "$@"
test -d "${GIT_DIR}/info" || mkdir -p "${GIT_DIR}/info"
add_patterns "${GIT_DIR}/info/exclude" "$@"
}
function add_patterns {