0
  #   ˆËÊÐ‚pÉa–Ü4ý( ©¤ýÔâ€vàƒq§ÔÅ£Ï Z    ‹      Õ–]oÚ0†ïû+<_ì¡ß4xêH¥¡Q@”iš¦©2±!V;²Œþú98m³©hTk»É9NÞœs‡ï¢Agümx…>�¯{høåc¯ÛA¸ðõ°�#ÿá¨Þ ®úáÄÚ¼°\.ëËÃºÒ3� ±YzÆjÛ:³“ƒ°xGP˜pÊœE¡6å¤+ÿ‰Ô�š[#wÿ­0¾17…oyÏ”^•æ¤b¼q>?)]ÿá¸‚�êò@™(œ(¶*ò¯žË…\ƒÐÉ:eájÚ-h*f²�­Ê1	E6CFÇm"VÒÀ$¥ò®>SŒhjÛø{·3øát`“âoR”h>mã�vÿbÐŽ0éÓŒ‡@Ÿ×\;Í%&=j,ÊSÁÙFñ�ßˆûÍ#¯‰¸‰µÈ­PòI
±Š«ÔäÔ±;‚DWU^ÂþÖ4þ­3†—£«þ8êŽ|—°"ÄSuÿ4r˜©æÒ¢Hh['*¹|’÷rbò‹‡&*«Öb–XLª¡g•/@�ª”q]…Ý„ùP¯·Õ*ÿ(«ÙhžÔ‚ œ£à´Õ8AèëŸË;©–²
àfÂ³ J¦BrL¼Ý  ÆYË=7¸=çóòdenýüÂ¤ÒØå´ut¾W(¢ØûJ’µ¿/c²ý¢ÈÕ’k·(¼}�úw¼(´Û˜Åa�É£»/Ãðc©uk³/åo?‹Ì|RáÑÿ·Ø9_¸³o_`Çó¨Änï•ä“JãíçÔ–÷(ov!¬ï�!ø;ì/x—É&       ˆÌËÑ418Ê¾Ï ¢    ‹      ­“QkÛ0…ßû+îô°·ø®4{Ye�Î,�&!u)¥Œ![²-¦XFºm–ýúÉqJ[h{’dºçœ+‰¿ËWYq»žÁ×ârëë/‹yl‚xs–!æE>þ˜&NgK¬%ê?!îv»dw–8ß`±Á–¶vŠ�¼©(Q¤˜8áÃ7q¼ÕRÅ8²ZÌ;¥‚«Ý=£ô{ï*¤ÖGp´­Ñ;Gö·NÝ[�Æ“qßKi­svŽtà8Ö‹
x”à¥SûAùô?ªÄbó²<ˆS/8µð ­iº”‘ë™àfÛ@ðUÊÐT®XZÙýHS3�–Rv7ÏVß"»—­Ô)ûœ¥ËóUš3±”[ÍQ¾Î\Fæ‚‰…Ñ¯©�VoÂW#|e~½]0™\‡Ê›>ïžPŒŸG­œ½ŒY?Æ­N�ˆúS7dõ¢ë‹ÍlYäóÍØ5”xr÷ïgÆÄZzÝäÆëŠœßC�
ï»2ôç�K8Zö¦i‰	€	¼JþM7ðxO8î"Çñü`ã±dh    $   !H403239_•I|¥‰ÓMjqØ‚¦ ë<óo¬ÀÑ  ï    !<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>
  @   #ˆl–Ãa¾”Ji?u	AàŸ¸ ©‹Fÿ‘þZ"Í”ƒd @6€´ÞÍ_óÕÏÎÔ61_†I|¥‚!ÂÓ  =    #‹      ÓË/-)(-Q¨æRPH´RH²æªåÒƒˆé�E“­RÀ¢)E¨ªRŠÐT  Äq{¹L     7   %ˆl–äY>”ÊeJeA3p\eÅ1hß�þBãO¬Ü¢|2—¤t þ×ƒmÐ7ÖÇÃÔ I    %# test_hooks.py -- Tests for executing hooks
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later version. You can redistribute it and/or
# modify it under the terms of either of these two licenses.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# You should have received a copy of the licenses; if not, see
# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
# License, Version 2.0.
#

"""Tests for executing hooks."""

import os
import stat
import shutil
import sys
import tempfile

from dulwich import errors

from dulwich.hooks import (
    PreCommitShellHook,
    PostCommitShellHook,
    CommitMsgShellHook,
)

from dulwich.tests import TestCase


class ShellHookTests(TestCase):
    def setUp(self):
        super().setUp()
        if os.name != "posix":
            self.skipTest("shell hook tests requires POSIX shell")
        self.assertTrue(os.path.exists("/bin/sh"))

    def test_hook_pre_commit(self):
        repo_dir = os.path.join(tempfile.mkdtemp())
        os.mkdir(os.path.join(repo_dir, "hooks"))
        self.addCleanup(shutil.rmtree, repo_dir)

        pre_commit_fail = """#!/bin/sh
exit 1
"""

        pre_commit_success = """#!/bin/sh
exit 0
"""
        pre_commit_cwd = (
            """#!/bin/sh
if [ "$(pwd)" != '"""
            + repo_dir
            + """' ]; then
    echo "Expected path '"""
            + repo_dir
            + """', got '$(pwd)'"
    exit 1
fi

exit 0
"""
        )

        pre_commit = os.path.join(repo_dir, "hooks", "pre-commit")
        hook = PreCommitShellHook(repo_dir, repo_dir)

        with open(pre_commit, "w") as f:
            f.write(pre_commit_fail)
        os.chmod(pre_commit, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)

        self.assertRaises(errors.HookError, hook.execute)

        if sys.platform != "darwin":
            # Don't bother running this test on darwin since path
            # canonicalization messages with our simple string comparison.
            with open(pre_commit, "