From 2c1352ab5d08270aa35c446eb108f4e24342d5d2 Mon Sep 17 00:00:00 2001 From: Matthias Lucas Jaros Date: Sun, 19 Oct 2025 18:30:47 +0200 Subject: Added check for git command --- run | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/run b/run index 55e8b55..be5fed9 100755 --- a/run +++ b/run @@ -2,9 +2,16 @@ set REPO_PERMISSIONS /etc/repo-permissions set GIT_COMMAND_REGEX "^(git-(?:upload-pack|receive-pack|upload-archive)) '((?:\/[a-zA-Z-]+)+.git)'\$" + +# check given git command +set -l matcher (string match -r -g $GIT_COMMAND_REGEX "$argv") +if test (count $matcher) -ne 2 + # there should be two groups otherwise something is wrong + exit 1 +end + # echo check for permissions set -l checkUser (whoami) -set -l matcher (string match -r -g $GIT_COMMAND_REGEX "$argv") set -l gitCommand $matcher[1] set -l repo $matcher[2] set -l repoDir srv repos -- cgit v1.3.1