Files
git-hooks/hooks/pre-receive
Joel Brobecker dc09109dca pre_receive.py, update, post_receive.py: Turn buffering off
While testing the behavior of the git-hooks under Python 3.x,
I noticed that the order of some output was not the same as
when running it with Python 2.x. When investigating further,
I found that the order with Python 2.x made better sense, and
that the different order was caused by stdout/stderr buffering.

This commit turns buffering off entirely in an effort to make
sure that output sent to stdout & stderr gets seen in the order
that it was sent.

As it happens, while this commit was aimed at Python 3.x,
running the testsuite showed that we had one testcase where
the order when using Python 2.x was also incorrect, and
therefore misleading, for a couple of tests. The tests'
expected output was double-checked, and adjusted accordingly,
with additional comments explaining what each part was about.

TN: U530-006
Change-Id: Iaf2c5266e13a645dab006e1f7f4cb553cbd5704f
2021-07-11 14:56:38 -07:00

14 lines
567 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 -u `dirname $0`/pre_receive.py "$@"