diff options
author | Erich Eckner <git@eckner.net> | 2018-09-28 14:47:08 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-09-28 14:47:08 +0200 |
commit | 08f12d9ad35ad778c4b0e182e95f509d95ae70b2 (patch) | |
tree | 53705a838fccc1d48bececc3c5f05345b043a557 | |
parent | 2a762bcfac22eb6fd0b75dd4b9430c9a4516136a (diff) | |
download | archive-server-08f12d9ad35ad778c4b0e182e95f509d95ae70b2.tar.xz |
httpdocs/index.php: accept commit hash, too
-rw-r--r-- | httpdocs/index.php | 13 |
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' ); |