Page MenuHomeSoftware Heritage

prevent git push --force to master
Closed, MigratedEdits Locked

Description

All development git repos have now been changed to allow dangerous changes, so that we can rebase in branches before merging.
But we do not want that to happen on master, so we need to inhibit --force pushes to master.
That should be doable using Herald rules. If so, having a global rule to that effect would be nice.

Event Timeline

zack raised the priority of this task from to Low.
zack updated the task description. (Show Details)
zack added a project: Developers.
olasd changed the visibility from "All Users" to "Public (No Login Required)".May 13 2016, 5:05 PM
zack claimed this task.
zack added a subscriber: zack.

This is now implemented by H22, e.g.:

git push  --force
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 281 bytes | 281.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: *** PUSH REJECTED BY COMMIT HOOK ***
remote: 
remote: This push was rejected by Herald push rule H22.
remote:     Change: branch/master
remote:       Rule: forbid dangerous changes to the master branch in any repository
remote:     Reason: dangerous changes to master branch are forbidden
remote: Transcript: https://forge.softwareheritage.org/herald/transcript/58415/
remote: 
To ssh://forge.softwareheritage.org/source/sandbox.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@forge.softwareheritage.org/source/sandbox.git'

while it works when force-pushing to branches other than master.