always copy git hooks, with adapted configs
This commit is contained in:
parent
86525472c0
commit
5ad4c597fe
@ -444,7 +444,8 @@ function installhooks() {
|
|||||||
pre-commit install --install-hooks --overwrite --allow-missing-config
|
pre-commit install --install-hooks --overwrite --allow-missing-config
|
||||||
}
|
}
|
||||||
function copyhooks() {
|
function copyhooks() {
|
||||||
cp -f ~/.git-template/.pre-commit-config.yaml ./
|
FILENAME=${1:-"$HOME/.git-template/.pre-commit-config.yaml"}
|
||||||
|
cp -f "$FILENAME" ./.pre-commit-config.yaml
|
||||||
installhooks
|
installhooks
|
||||||
runhooks
|
runhooks
|
||||||
}
|
}
|
||||||
@ -465,8 +466,12 @@ function git_listobjectsbysize() {
|
|||||||
function setorigin() {
|
function setorigin() {
|
||||||
gra origin "$1" 2>/dev/null
|
gra origin "$1" 2>/dev/null
|
||||||
grset origin "$1"
|
grset origin "$1"
|
||||||
if [[ "$1" =~ *"$COMPANY_NAME"* ]]; then
|
success "updated origin to $1"
|
||||||
|
arrow "copying pre-commit hooks ..."
|
||||||
|
if [[ "$1" =~ "$COMPANY_NAME" ]]; then
|
||||||
copyhooks
|
copyhooks
|
||||||
|
else
|
||||||
|
copyhooks "$HOME/.git-template/.pre-commit-minimal-config.yaml"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function gitpushcurrentremote() {
|
function gitpushcurrentremote() {
|
||||||
@ -493,9 +498,11 @@ function clone() {
|
|||||||
success "repository cloned"
|
success "repository cloned"
|
||||||
if [[ -n "$folder" ]]; then
|
if [[ -n "$folder" ]]; then
|
||||||
cd "$folder" || exit
|
cd "$folder" || exit
|
||||||
if [[ "$1:u" =~ *"$COMPANY_NAME:u"* ]]; then
|
|
||||||
arrow "copying pre-commit hooks ..."
|
arrow "copying pre-commit hooks ..."
|
||||||
|
if [[ "$1:u" =~ "$COMPANY_NAME:u" ]]; then
|
||||||
copyhooks
|
copyhooks
|
||||||
|
else
|
||||||
|
copyhooks "$HOME/.git-template/.pre-commit-minimal-config.yaml"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
error "unable to change current directory to : $folder"
|
error "unable to change current directory to : $folder"
|
||||||
|
Loading…
Reference in New Issue
Block a user