summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquentin@aristote.fr <quentin@aristote.fr>2026-01-29 21:56:40 +0100
committerquentin@aristote.fr <quentin@aristote.fr>2026-01-29 22:10:27 +0100
commit4d3b399ce8e4d128e495196c1504675806cf934e (patch)
tree168beace8e131263db34d049238308df716d4cd9
parent1e6497c1494ca66452225f4e6badb68791f08678 (diff)
git: change default view of repo to their tree
-rw-r--r--config/services/web/git/default.nix8
-rwxr-xr-xtests/run-tests.sh12
2 files changed, 13 insertions, 7 deletions
diff --git a/config/services/web/git/default.nix b/config/services/web/git/default.nix
index 4a7d103..bd8c128 100644
--- a/config/services/web/git/default.nix
+++ b/config/services/web/git/default.nix
@@ -11,10 +11,10 @@
extraConfig = ''
proxy_redirect default;
# fix internal hyperlinks
- proxy_set_header Accept-Encoding "";
- sub_filter_once off;
- sub_filter 'href=\'/git/' 'href=\'/';
- sub_filter 'action=\'/git/' 'action=\'/';
+ proxy_set_header Accept-Encoding "";
+ subs_filter "href='/" "href='/";
+ subs_filter "action='/" "action='/";
+ subs_filter "href='/([^/]*)/([^/]*)/'" "href=/$1/$2/tree/" r;
'';
};
};
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 401b0c3..6e161a2 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -91,15 +91,21 @@ echo Done.
echo
echo Checking cgit instance:
-echo Checking internal hyperlinks ...
RESULT=$(curl "http://$IP:${PORTS[git]}/" $CURL_FLAGS)
-if [[ $(echo "$RESULT" | grep "=\'/git/" > /dev/null) ]]
+echo "Checking that internal hyperlinks don't start with 'git' ..."
+if $(echo "$RESULT" | grep --silent "=\'/git/")
then
- echo "Broken hyperlinks detected."
+ echo "Broken hyperlinks detected."
+fi
+echo Checking that the default view of repositories is their tree ...
+if $(echo "$RESULT" | grep --silent "href='/[^/]*/[^/]*/'")
+then
+ echo "Broken hyperlinks detected."
fi
echo Done.
+echo
echo Checking custom Searx engines :
declare -A QUERIES
QUERIES[alternativeto]=Searx