On Tue, Oct 17, 2023 at 12:18 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > Robert Haas <robertmh...@gmail.com> writes: > > One potential problem with a server-side hook is that if you back-port > > a commit to older branches and then push the commits all together > > (which is my workflow) then you might get failure to push on some > > branches but not others. I don't know if there's any way to avoid > > that, but it seems not great. You could think of enforcing the policy > > only on master to try to avoid this, but that still leaves a risk that > > you manage to push to all the back-branches and not to master. > > Is that actually possible? I had the idea that "git push" is an > atomic operation, ie 100% or nothing. Is it only atomic per-branch?
I believe so. For instance: [rhaas pgsql]$ git push rhaas Enumerating objects: 2980, done. Counting objects: 100% (2980/2980), done. Delta compression using up to 16 threads Compressing objects: 100% (940/940), done. Writing objects: 100% (2382/2382), 454.52 KiB | 7.70 MiB/s, done. Total 2382 (delta 2024), reused 1652 (delta 1429), pack-reused 0 remote: Resolving deltas: 100% (2024/2024), completed with 579 local objects. To ssh://git.postgresql.org/users/rhaas/postgres.git e434e21e11..2406c4e34c master -> master ! [rejected] walsummarizer2 -> walsummarizer2 (non-fast-forward) error: failed to push some refs to 'ssh://git.postgresql.org/users/rhaas/postgres.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and integrate the remote changes hint: (e.g. 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. -- Robert Haas EDB: http://www.enterprisedb.com