From 256044c04f3cbaec11c68345309fb570b55ade6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20von=20B=C3=BClow?= <48244604+rvbuelow@users.noreply.github.com> Date: Wed, 2 Oct 2019 12:42:14 +0200 Subject: [PATCH] Use GIT_DIR environment variable to to set .git directory --- bin/git-ignore | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/git-ignore b/bin/git-ignore index 7c4d7ec..c0e91fb 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -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 {