From fef1cd6b512f7b277ce604c76e57fcea940fdff9 Mon Sep 17 00:00:00 2001 From: Bhupesh-V Date: Tue, 7 Jun 2022 20:08:41 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20add=20support=20for=20setting=20?= =?UTF-8?q?up=20gitconfig=20while=20installing=20(linux=20only)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/install b/install index 5ef28bd..147c700 100755 --- a/install +++ b/install @@ -91,11 +91,36 @@ download_ugit(){ fi } +config_check() { + reflogExpire=$(git config --get gc.reflogExpire) + if [ "$reflogExpire" = "" ] ; then + printf "%s\n" "Setting ${BOLD}gc.reflogExpire${RESET} to 200 days" + if ! git config --global gc.reflogExpire 200; then + printf "%s\n" "Unexpected error while setting up gitconfig" + exit 1 + fi + elif [ "$reflogExpire" -lt 200 ]; then + printf "%s\n" "ugit recommends increasing ${BOLD}gc.reflogExpire${RESET} config duration to 200 days." + fi + + reflogExpireUnreachable=$(git config --get gc.reflogExpireUnreachable) + if [ "$reflogExpireUnreachable" = "" ]; then + printf "%s\n" "Setting ${BOLD}gc.reflogExpireUnreachable${RESET} to 90 days" + if ! git config --global gc.reflogExpireUnreachable 90; then + printf "%s\n" "Unexpected error while setting up gitconfig" + exit 1 + fi + elif [ "$reflogExpireUnreachable" -lt 90 ]; then + printf "%s\n" "ugit recommends increasing ${BOLD}gc.reflogExpireUnreachable${RESET} config duration to 90 days." + fi +} + main () { status_check check_dependencies download_ugit + config_check printf "${BOLD}${ORANGE_FG}%s\n" "" printf "%s\n" " _ _ "