Skip to content

Commit 7a03061

Browse files
committed
Hook-it should configure gitflow.allow-master-commit and gitflow.allow-conflict-master
1 parent 6944c64 commit 7a03061

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

hook-it

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ function inject_hooks() {
5151
$NOOP $GIT -C $repo config gitflow.hotfix.finish.message "Hotfix %tag%"
5252
$NOOP $GIT -C $repo config gitflow.release.finish.message "Release %tag%"
5353

54+
if [[ -z $($GIT -C $repo config --get gitflow.branch.allow-master-commit) ]]; then
55+
$NOOP $GIT -C $repo config gitflow.branch.allow-master-commit false
56+
fi
57+
58+
if [[ -z $($GIT -C $repo config --get gitflow.branch.allow-conflict-commit) ]]; then
59+
$NOOP $GIT -C $repo config gitflow.branch.allow-conflict-commit false
60+
fi
61+
5462
# 3/ find language
5563
if [[ -e $repo/package.json ]]; then
5664
language="node"
@@ -170,4 +178,4 @@ function main() {
170178
inject_hooks "$1" || die "$ERROR"
171179
}
172180

173-
main "$@"
181+
main "$@"

hook-it.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ if ($PSCmdlet.ShouldProcess("gitflow", "Configure Messages")) {
5959
Write-Error "git flow Release Finish Message configuration failed"
6060
exit 1
6161
}
62+
if ( (git -C $Path config --get gitflow.branch.allow-master-commit) == "" ) {
63+
git -C $Path config --bool gitflow.branch.allow-master-commit false
64+
if ( $LASTEXITCODE -ne 0 ) {
65+
Write-Error "git flow Allow Master Commit configuration failed"
66+
exit 1
67+
}
68+
}
69+
if ( (git -C $Path config --get gitflow.branch.allow-config-commit) == "" ) {
70+
git -C $Path config --bool gitflow.branch.allow-config-commit false
71+
if ( $LASTEXITCODE -ne 0 ) {
72+
Write-Error "git flow Allow Conflict Commit configuration failed"
73+
exit 1
74+
}
75+
}
6276
}
6377

6478
# 3/ copy hooks

0 commit comments

Comments
 (0)