Bug 263259

Summary: merge check hook is too restrictive
Product: Services Reporter: Ed Maste <emaste>
Component: Git IntegrationAssignee: Li-Wen Hsu <lwhsu>
Status: Closed FIXED    
Severity: Affects Only Me CC: lwhsu
Priority: ---    
Version: unspecified   
Hardware: Any   
OS: Any   

Description Ed Maste freebsd_committer freebsd_triage 2022-04-13 14:01:11 UTC
I am trying to update ssh to 8.9p1

$ git push freebsd 6ef6428c2ba32b372c6c261387e0ce3f91b0b28b:main
Enumerating objects: 196, done.
Counting objects: 100% (196/196), done.
Delta compression using up to 8 threads
Compressing objects: 100% (68/68), done.
Writing objects: 100% (100/100), 34.57 KiB | 863.00 KiB/s, done.
Total 100 (delta 82), reused 46 (delta 32), pack-reused 0
remote: Resolving deltas: 100% (82/82), completed with 81 local objects.
remote: ================================================================
remote: Currently only allow merge from vendor/*
remote: ================================================================
remote: FATAL: VREF/MERGE-CHECK/src: helper program exit status 256
remote: error: hook declined to update refs/heads/main
To ssh://gitrepo.freebsd.org/src.git
 ! [remote rejected]           6ef6428c2ba32b372c6c261387e0ce3f91b0b28b -> main (hook declined)
error: failed to push some refs to 'ssh://gitrepo.freebsd.org/src.git'

$ git show 6ef6428c2ba32b372c6c261387e0ce3f91b0b28b
commit 6ef6428c2ba32b372c6c261387e0ce3f91b0b28b
Merge: 033718abc859 85d1f2d49355
Author: Ed Maste <emaste@FreeBSD.org>
Date:   Wed Apr 13 09:57:16 2022 -0400

    ssh: update to OpenSSH v8.9p1

$ git log vendor/openssh
commit 7f9f5c27f6f623a2081f2b436692418fd962b903 (tag: vendor/openssh/9.0p1, freebsd/vendor/openssh, vendor/openssh)
Author: Ed Maste <emaste@FreeBSD.org>
Date:   Fri Apr 8 13:19:17 2022 -0400

    Vendor import of OpenSSH 9.0p1

commit 9b7e085bc027cd9fe4c54e71b49e276559d82983 (github/vendor/openssh)
Author: Ed Maste <emaste@FreeBSD.org>
Date:   Wed Mar 23 11:43:43 2022 -0400

    Import openssh V_8_9 branch updates
    
    Obtained from:  OpenSSH 5880200867e440f8ab5fd893c93db86555990443

commit 85d1f2d493556f113b3f1f4b1800ace6656627ad (tag: vendor/openssh/8.9p1)
Author: Ed Maste <emaste@FreeBSD.org>
Date:   Wed Feb 23 13:16:45 2022 -0500

    Vendor import of OpenSSH 8.9p1

...

Note that the merge-from commit is indeed on vendor/openssh
Comment 1 Ed Maste freebsd_committer freebsd_triage 2022-04-13 15:48:53 UTC
Commit is available in this fork/branch:
https://github.com/emaste/freebsd/tree/openssh-8.8p1-update
Comment 2 Li-Wen Hsu freebsd_committer freebsd_triage 2022-04-14 15:36:32 UTC
The merge checker commit hook was using `git show-ref` to find which (vendor) branch is the 2nd parent of the merge commit.  It cannot handle if the vendor branch is updated and the parent is no longer the HEAD of that branch.  Change to use `git branch --contains <commit>`