Skip to content

Commit

Permalink
Hook-it should configure gitflow.allow-master-commit and gitflow.allo…
Browse files Browse the repository at this point in the history
…w-conflict-master
  • Loading branch information
gildas committed Jan 23, 2023
1 parent 6944c64 commit 7a03061
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion hook-it
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -170,4 +178,4 @@ function main() {
inject_hooks "$1" || die "$ERROR"
}

main "$@"
main "$@"
14 changes: 14 additions & 0 deletions hook-it.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a03061

Please sign in to comment.