diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-07 18:11:58 +0100 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-07 18:11:58 +0100 |
| commit | 35e1458756ec58bb1cb5f347cfb9c0ca214d9561 (patch) | |
| tree | 24ae47eb8e1f1d1a425115df4df2170d021ac39d /usr | |
| parent | cf072ba19c0883aa159c0155ccb317ac28e0d775 (diff) | |
| download | git.zue.dev-35e1458756ec58bb1cb5f347cfb9c0ca214d9561.tar git.zue.dev-35e1458756ec58bb1cb5f347cfb9c0ca214d9561.tar.gz git.zue.dev-35e1458756ec58bb1cb5f347cfb9c0ca214d9561.tar.bz2 git.zue.dev-35e1458756ec58bb1cb5f347cfb9c0ca214d9561.tar.xz git.zue.dev-35e1458756ec58bb1cb5f347cfb9c0ca214d9561.zip | |
Normalize the SSH_ORIGINAL_COMMAND
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/local/bin/git-wrapper | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/usr/local/bin/git-wrapper b/usr/local/bin/git-wrapper index 456a289..12c6d21 100644 --- a/usr/local/bin/git-wrapper +++ b/usr/local/bin/git-wrapper @@ -7,6 +7,12 @@ if [ -z "$SSH_ORIGINAL_COMMAND" ]; then exit 1 fi +# Normalize the SSH_ORIGINAL_COMMAND as modern Git clients can send either form depending on version and protocol negotiation +SSH_ORIGINAL_COMMAND=$(echo "$SSH_ORIGINAL_COMMAND" | sed \ + 's/^git upload-pack/git-upload-pack/; + s/^git receive-pack/git-receive-pack/; + s/^git upload-archive/git-upload-archive/') + # Parse the SSH_ORIGINAL_COMMAND to extract the git command and the repository path. The expected format is something like "git-upload-pack 'repository.git'". cmd=$(echo "$SSH_ORIGINAL_COMMAND" | cut -d' ' -f1) path=$(echo "$SSH_ORIGINAL_COMMAND" | cut -d"'" -f2) |
