From af3663edec48f252f510f66f663e1af323cdfa0f Mon Sep 17 00:00:00 2001
From: Tobias Bell <uberspace@tobiasbell.de>
Date: Fri, 8 Jun 2018 22:07:30 +0200
Subject: [PATCH] Don't bail out if git gc removed refs

---
 include/version.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/version.php b/include/version.php
index 1d7567bb..2cf7b1de 100644
--- a/include/version.php
+++ b/include/version.php
@@ -14,6 +14,8 @@
 				if (preg_match("/^ref: (.*)/", $head, $matches)) {
 					$ref = $matches[1];
 
+					if (!file_exists("$root_dir/.git/$ref"))
+						return VERSION_STATIC;
 					$suffix = substr(trim(file_get_contents("$root_dir/.git/$ref")), 0, 7);
 					$timestamp = filemtime("$root_dir/.git/$ref");
 
-- 
2.39.5