summaryrefslogtreecommitdiff
path: root/run
diff options
context:
space:
mode:
authorGravatar Matthias Lucas Jaros <jarlucmat@mailbox.org>2025-10-19 18:30:47 +0200
committerGravatar Matthias Lucas Jaros <jarlucmat@mailbox.org>2025-10-19 18:30:47 +0200
commit2c1352ab5d08270aa35c446eb108f4e24342d5d2 (patch)
treea433f2d6c5666c497aa01bbcddb9642697c24f7a /run
parentf63a147d6b9c2ffd87bee0d30a71310f2c9ef8af (diff)
Added check for git command
Diffstat (limited to 'run')
-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