summaryrefslogtreecommitdiff
path: root/httpdocs/index.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-28 14:47:08 +0200
committerErich Eckner <git@eckner.net>2018-09-28 14:47:08 +0200
commit08f12d9ad35ad778c4b0e182e95f509d95ae70b2 (patch)
tree53705a838fccc1d48bececc3c5f05345b043a557 /httpdocs/index.php
parent2a762bcfac22eb6fd0b75dd4b9430c9a4516136a (diff)
downloadarchive-server-08f12d9ad35ad778c4b0e182e95f509d95ae70b2.tar.xz
httpdocs/index.php: accept commit hash, too
Diffstat (limited to 'httpdocs/index.php')
-rw-r--r--httpdocs/index.php13
1 files 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'
);