diff --git a/hook-it b/hook-it index 0deb072..3b717ff 100755 --- a/hook-it +++ b/hook-it @@ -51,6 +51,14 @@ function inject_hooks() { $NOOP $GIT -C $repo config gitflow.hotfix.finish.message "Hotfix %tag%" $NOOP $GIT -C $repo config gitflow.release.finish.message "Release %tag%" + if [[ -z $($GIT -C $repo config --get gitflow.branch.allow-master-commit) ]]; then + $NOOP $GIT -C $repo config gitflow.branch.allow-master-commit false + fi + + if [[ -z $($GIT -C $repo config --get gitflow.branch.allow-conflict-commit) ]]; then + $NOOP $GIT -C $repo config gitflow.branch.allow-conflict-commit false + fi + # 3/ find language if [[ -e $repo/package.json ]]; then language="node" @@ -170,4 +178,4 @@ function main() { inject_hooks "$1" || die "$ERROR" } -main "$@" \ No newline at end of file +main "$@" diff --git a/hook-it.ps1 b/hook-it.ps1 index f0156f4..c1f2118 100644 --- a/hook-it.ps1 +++ b/hook-it.ps1 @@ -59,6 +59,20 @@ if ($PSCmdlet.ShouldProcess("gitflow", "Configure Messages")) { Write-Error "git flow Release Finish Message configuration failed" exit 1 } + if ( (git -C $Path config --get gitflow.branch.allow-master-commit) == "" ) { + git -C $Path config --bool gitflow.branch.allow-master-commit false + if ( $LASTEXITCODE -ne 0 ) { + Write-Error "git flow Allow Master Commit configuration failed" + exit 1 + } + } + if ( (git -C $Path config --get gitflow.branch.allow-config-commit) == "" ) { + git -C $Path config --bool gitflow.branch.allow-config-commit false + if ( $LASTEXITCODE -ne 0 ) { + Write-Error "git flow Allow Conflict Commit configuration failed" + exit 1 + } + } } # 3/ copy hooks