diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-09-10 18:59:03 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-09-10 18:59:03 -0400 |
commit | 12e3360f833dbc83e995aed1ba67b74fc95e3ec3 (patch) | |
tree | bed8d2ce2309e2bab18cdab0931fb60d290c3fa9 /tools/git-setup | |
parent | 2a5c8b237b1b0303bf6d0f6cc762bb9cafac35c9 (diff) |
sync other tools from master
Diffstat (limited to 'tools/git-setup')
-rwxr-xr-x | tools/git-setup | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/git-setup b/tools/git-setup new file mode 100755 index 0000000000..f40a7724d9 --- /dev/null +++ b/tools/git-setup @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +cd "$(dirname -- "$0")" +cd "$(git rev-parse --show-toplevel)" + +if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then + # This part is allowed to fail + cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \ + chmod +x .git/hooks/pre-commit && \ + echo "Activated pre-commit hook." || : +fi + +declare -A fetch +git config -f .gitconfig --get-regexp '.*' | while read -r key val; do + if [[ $key = *.fetch ]]; then + if [[ -z "${fetch[$key]}" ]]; then + git config --local --unset-all "$key" + fetch[$key]='true' + fi + git config --local --add "$key" "$val" + else + git config --local "$key" "$val" + fi +done |