summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthias Jaros <jarlucmat@mailbox.org>2025-10-19 18:30:47 +0200
committerGravatar Matthias Jaros <jarlucmat@mailbox.org>2025-10-19 18:30:47 +0200
commita200e8c7b4b9b26e06e4e06e7c845a38b472b11a (patch)
treea433f2d6c5666c497aa01bbcddb9642697c24f7a
parentbdd303764d6401be9408ddc43976c7fea1825991 (diff)
Added check for git command
-rwxr-xr-xrun9
1 files changed, 8 insertions, 1 deletions
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