From 88ea239f586786accac5bf508299579c9856663e Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Wed, 26 Oct 2022 23:52:56 +0900 Subject: [PATCH] use include gitconfig --- .gitconfig => gitconfig | 0 install | 1 + mod.bash | 9 +++++++++ 3 files changed, 10 insertions(+) rename .gitconfig => gitconfig (100%) diff --git a/.gitconfig b/gitconfig similarity index 100% rename from .gitconfig rename to gitconfig diff --git a/install b/install index b738198..0183845 100755 --- a/install +++ b/install @@ -5,5 +5,6 @@ cd -- "$(dirname -- "$0")" (($(id -u) == 0)) \ && [[ -f /etc/debian_version ]] \ && install_apt_packages +install_gitconfig install_dotfiles install_addons "$@" diff --git a/mod.bash b/mod.bash index 618b9b5..44c17cc 100644 --- a/mod.bash +++ b/mod.bash @@ -11,6 +11,15 @@ function install_apt_packages() { apt install -y "${packages[@]}" } +function install_gitconfig() { + if (($(id -u) == 0)); then + sudo --user="#${SUDO_UID:-0}" \ + git config --global --add include.path "$(realpath gitconfig)" + else + git config --global --add include.path "$(realpath gitconfig)" + fi +} + function install_dotfiles() { local home local dotfile