mirror of
https://github.com/AdaCore/git-hooks.git
synced 2026-02-12 12:43:11 -08:00
The main purpose of that pre-receive hook is to ensure that any push updating the refs/meta/config reference only updates that one reference. A large comment was added to the code to explain why (in short, this is a pre-requisite for being able to use the git-hooks config at the same time the config changes are being pushed). While at it, to be consistent with the other hooks, support for a repository-specific pre-receive hook is added. One side-effect of this is that we end up trying to query the hooks configuration, which triggers a check for the existence of the refs/meta/config branch. As a result, an extra copy of the same warning gets generated when the reference doesn't exist. This is not super elegant, but isn't a problem in practice, since this is part of handling a deprecated feature that we'll try to remove support for hopefully soon. In the meantime, this isn't blocking to adding support for the pre-receive option. Since this commit increased the number of times `refs/meta/config` was spelled out (aka "hardcoded"), this commit introduces a new constant to avoid duplicating that special reference name. Change-Id: Ib4fc0a32f639fe693e4d43269baf8c0838fc9214 TN: T227-003
14 lines
564 B
Bash
Executable File
14 lines
564 B
Bash
Executable File
#! /usr/bin/env bash
|
|
#
|
|
# The "pre-receive" hook is the first hook to be executed when handling
|
|
# a push from a client. It takes a list of references being updated
|
|
# from stdin. A non-zero status code causes the entire push request
|
|
# to be rejected, meaning that none of the references get updated.
|
|
|
|
# The following is AdaCore-specific: It allows us to make sure that
|
|
# we are not running a random version of Python, but rather the
|
|
# baseline version installed in /gnatmail.
|
|
export PATH=/gnatmail/local/gnatpython/bin:$PATH
|
|
|
|
python `dirname $0`/pre_receive.py "$@"
|