aboutsummaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rw-r--r--usr/local/bin/git-wrapper16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/local/bin/git-wrapper b/usr/local/bin/git-wrapper
new file mode 100644
index 0000000..b0e45b3
--- /dev/null
+++ b/usr/local/bin/git-wrapper
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Prepend /repositories/ to bare repo paths in git SSH commands
+case "$SSH_ORIGINAL_COMMAND" in
+ git-upload-pack\'*|git-receive-pack\'*|git-upload-archive\'*)
+ cmd="${SSH_ORIGINAL_COMMAND%\'*}"
+ path="${SSH_ORIGINAL_COMMAND##*\'}"
+ path="${path%\'}"
+ # Prepend /repositories/ if not an absolute path
+ [[ "$path" != /* ]] && path="/repositories/$path"
+ exec $cmd "'$path'"
+ ;;
+ *)
+ echo "Invalid command" >&2
+ exit 1
+ ;;
+esac \ No newline at end of file