From 86ddbd97133f50037f0f45eb5980003a26bc6228 Mon Sep 17 00:00:00 2001 From: Tran Ngoc Duc Date: Thu, 2 May 2024 21:12:25 +0700 Subject: [PATCH] fix git not apply for current user --- src/debian/changelog | 5 +-- var/ductn | 2 + var/lib/git.sh | 96 ++++++++++++++++++++++---------------------- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/debian/changelog b/src/debian/changelog index 6d1878ce..c527fb30 100644 --- a/src/debian/changelog +++ b/src/debian/changelog @@ -1,6 +1,5 @@ -ductn (4.0.2+debian~rc1.1) mantic; urgency=medium +ductn (4.0.2+debian~rc1.2) mantic; urgency=medium - * support mssql - * ISSUES fix + * ISSUES git config for current user -- Tran Ngoc Duc Sun, 01 Oct 2023 10:59:38 +0700 diff --git a/var/ductn b/var/ductn index 7c8e645a..7aacc69c 100755 --- a/var/ductn +++ b/var/ductn @@ -13,4 +13,6 @@ declare -F | awk '{print $3}' | grep -e "^--" | sed 's/--//g' | grep -v "commands" } +[ ! -x "--$@" ] && echo "ductn: '$1' is not a ductn command." && exit 1 + "--$@" diff --git a/var/lib/git.sh b/var/lib/git.sh index 733baeb8..e4cf1664 100644 --- a/var/lib/git.sh +++ b/var/lib/git.sh @@ -2,55 +2,53 @@ #!/bin/bash --git:configure() { - if [[ "$USERNAME" == "ductn" ]]; then - # global gitignore - git config --global core.excludesfile ~/.gitignore - - # setting - git config --global user.name "Tran Ngoc Duc" - git config --global user.email "caothu91@gmail.com" - - # alias - # git config --global alias.plog "log --graph --pretty=format:'%h -%d %s %n' --abbrev-commit --date=relative --branches" - - # push - git config --global push.default simple - - # file mode - git config --global core.fileMode false - - # line endings - git config --global core.autocrlf false - git config --global core.eol lf - - # Cleanup - git config --global gc.auto 0 - - # remote server - git config --global receive.denyCurrentBranch updateInstead - - echo "$_gitignore" >~/.gitignore - chmod 644 ~/.gitignore - - # if [[ -d ./.git ]]; then - # # remote repository - - # # cat <.git/hooks/push-to-checkout - # # #!/bin/sh - # # set -ex - # # git read-tree --reset -u HEAD "$1" - # # EOF - - # # cat <.git/hooks/pre-commit - # # #!/bin/sh - # # echo $(tail -1 version | xargs) | awk -F. -v OFS=. '{$NF += 1 ; print}' >>version - # # echo $(tail -1 version | xargs) >version - # # git add version - # # exit 0 - # # EOF - # chmod +x ./.git/hooks/* - # fi - fi + # global gitignore + git config --global core.excludesfile ~/.gitignore + + # setting + git config --global user.name "Tran Ngoc Duc" + git config --global user.email "caothu91@gmail.com" + + # alias + # git config --global alias.plog "log --graph --pretty=format:'%h -%d %s %n' --abbrev-commit --date=relative --branches" + + # push + git config --global push.default simple + + # file mode + git config --global core.fileMode false + + # line endings + git config --global core.autocrlf false + git config --global core.eol lf + + # Cleanup + git config --global gc.auto 0 + + # remote server + git config --global receive.denyCurrentBranch updateInstead + + echo "$_gitignore" >~/.gitignore + chmod 644 ~/.gitignore + + # if [[ -d ./.git ]]; then + # # remote repository + + # # cat <.git/hooks/push-to-checkout + # # #!/bin/sh + # # set -ex + # # git read-tree --reset -u HEAD "$1" + # # EOF + + # # cat <.git/hooks/pre-commit + # # #!/bin/sh + # # echo $(tail -1 version | xargs) | awk -F. -v OFS=. '{$NF += 1 ; print}' >>version + # # echo $(tail -1 version | xargs) >version + # # git add version + # # exit 0 + # # EOF + # chmod +x ./.git/hooks/* + # fi } _gitignore=$(