Files
git-hooks/hooks/post-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

31 lines
1.0 KiB
Bash
Executable File

#! /usr/bin/env bash
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form:
#
# <oldrev> <newrev> <refname>
#
# For example:
#
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
# The following is sourceware-specific. Some of the tools installed
# on that machine are too old, causing some really interesting features
# to be missing (Eg: python's OrderedDict, for instance, or git's %B
# format placeholder). So, local installs of more recent versions have
# been placed in /opt/rh/[...].
for tool in git19 python27
do
if [ -f /opt/rh/$tool/enable ]; then
. /opt/rh/$tool/enable
fi
done
# 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`/post_receive.py "$@"