aboutsummaryrefslogtreecommitdiffstats
path: root/www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch')
-rw-r--r--www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch45
1 files changed, 43 insertions, 2 deletions
diff --git a/www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch b/www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch
index 4331629..93bd4eb 100644
--- a/www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch
+++ b/www-apps/cgit/files/cgit-1.2.3-git-http-backend.patch
@@ -1,4 +1,4 @@
-From d90a0186d519bae5dddb25830eb07b6d8d2287ec Mon Sep 17 00:00:00 2001
+From 6c9eb981818260af3b7f4235185ab8b0f94c4f5e Mon Sep 17 00:00:00 2001
From: Wynn Wolf Arbor <wolf@oriole.systems>
Date: Sat, 30 May 2020 21:51:39 +0200
Subject: [PATCH] Support Git over HTTP by proxying git-http-backend(1)
@@ -34,18 +34,59 @@ Notable changes to the original patch:
def_cmd() macro directly, as the endpoints "git-upload-pack" and
"git-receive-pack" contain dashes.
+ * The original patch did not account for caching support, which will
+ break the whole clone process if enabled. Work around this by
+ disabling the cache for commands that have is_clone set to true.
+
[1] https://lists.zx2c4.com/pipermail/cgit/2014-December/002312.html
[2] https://lists.zx2c4.com/pipermail/cgit/2016-February/002907.html
[3] https://lists.zx2c4.com/pipermail/cgit/2016-February/002926.html
---
+ cache.c | 11 +++++++++++
cgit.c | 3 +++
cgit.h | 1 +
cgitrc.5.txt | 8 ++++++++
cmd.c | 13 +++++++++++++
ui-clone.c | 42 ++++++++++++++++++++++++++++++++++++++++++
ui-clone.h | 2 ++
- 6 files changed, 69 insertions(+)
+ 7 files changed, 80 insertions(+)
+diff --git a/cache.c b/cache.c
+index 2c70be7..bb4fc47 100644
+--- a/cache.c
++++ b/cache.c
+@@ -15,6 +15,7 @@
+
+ #include "cgit.h"
+ #include "cache.h"
++#include "cmd.h"
+ #include "html.h"
+ #ifdef HAVE_LINUX_SENDFILE
+ #include <sys/sendfile.h>
+@@ -356,6 +357,7 @@ int cache_process(int size, const char *path, const char *key, int ttl,
+ struct strbuf filename = STRBUF_INIT;
+ struct strbuf lockname = STRBUF_INIT;
+ struct cache_slot slot;
++ struct cgit_cmd *cmd;
+ int result;
+
+ /* If the cache is disabled, just generate the content */
+@@ -370,6 +372,15 @@ int cache_process(int size, const char *path, const char *key, int ttl,
+ fn();
+ return 0;
+ }
++
++ cmd = cgit_get_cmd();
++
++ /* Do not cache files that are being cloned */
++ if (cmd && cmd->is_clone) {
++ fn();
++ return 0;
++ }
++
+ if (!key)
+ key = "";
+ hash = hash_str(key) % size;
diff --git a/cgit.c b/cgit.c
index c4320f0..fc85c18 100644
--- a/cgit.c