[SERVER-33905] Only run pre-push githooks when the remote URL matches mongodb/mongo Created: 15/Mar/18  Updated: 29/Oct/23  Resolved: 15/Mar/18

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 3.7.3
Fix Version/s: 3.7.4

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Storage NYC 2018-03-26
Participants:

 Description   

Our install-hooks script runs when a user pushes to a remote repo other than "mongodb/mongo", which is annoying when pushing to "master" on a fork that user owns.



 Comments   
Comment by Githook User [ 15/Mar/18 ]

Author:

{'email': 'louis.williams@mongodb.com', 'name': 'Louis Williams', 'username': 'louiswilliams'}

Message: SERVER-33905 Only run pre-push githooks when the remote URL matches MongoDB repo
Branch: master
https://github.com/mongodb/mongo/commit/3ba2ef775d4f3646d6b6e1821239b9c6a0ea753f

Comment by Kyle Suarez [ 15/Mar/18 ]

I had no idea; that's cool!

Comment by Louis Williams [ 15/Mar/18 ]

I used the $2 argument, the URL, to match "mognodb/mongo". Not everyone names the "real" remote repo the same, and this will save other people the time of manually editing their pre-push script.

Comment by Kyle Suarez [ 15/Mar/18 ]

I named the "real" mongodb repository remote "upstream", so I manually patched my own .git/hooks/pre-push to start with:

#!/bin/bash
 
remote_name=$1
if [ $remote_name != "upstream" ]; then
    exit 0
fi
# ...

Generated at Thu Feb 08 04:34:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.