From 08f12d9ad35ad778c4b0e182e95f509d95ae70b2 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 28 Sep 2018 14:47:08 +0200 Subject: httpdocs/index.php: accept commit hash, too --- httpdocs/index.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/httpdocs/index.php b/httpdocs/index.php index 4f11f49..3295c38 100644 --- a/httpdocs/index.php +++ b/httpdocs/index.php @@ -18,11 +18,18 @@ if (isset($_GET['r'])) { if (base64_decode($_GET['tag'],true)===false) $_GET['tag'] = base64_encode($_GET['tag']); - $handle = popen( - 'git -C "../work/repositories/' . $_GET['r'] . '" archive "$(' . + $commit_identifier = '$(' . 'echo "' . $_GET['tag'] . '" | ' . 'base64 -d' . - ')" | ' . + ')'; + } elseif (isset($_GET['commit'])) { + if (preg_match('/^[a-f0-9]{40}$/', $_GET['commit'])) + $commit_identifier = $_GET['commit']; + } + + if (isset($commit_identifier)) { + $handle = popen( + 'git -C "../work/repositories/' . $_GET['r'] . '" archive "' . $commit_identifier . '" | ' . 'gzip -nc', 'r' ); -- cgit v1.2.3-70-g09d2