aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-17 11:59:09 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-17 11:59:09 +0800
commit3adb46b7e1225e8f339d248f0ef9c32e34b20d9d (patch)
treeb5fa1e199338252e1784ba10a1a9e65b91e0d5c4
parent*.go: Reformat (diff)
downloadforge-3adb46b7e1225e8f339d248f0ef9c32e34b20d9d.tar.gz
forge-3adb46b7e1225e8f339d248f0ef9c32e34b20d9d.tar.zst
forge-3adb46b7e1225e8f339d248f0ef9c32e34b20d9d.zip
*_handle_*_pack.go: Pass env LINDENII_FORGE_HOOKS_SOCKET_PATH
Diffstat (limited to '')
-rw-r--r--http_handle_repo_upload_pack.go2
-rw-r--r--ssh_handle_receive_pack.go2
-rw-r--r--ssh_handle_upload_pack.go2
3 files changed, 6 insertions, 0 deletions
diff --git a/http_handle_repo_upload_pack.go b/http_handle_repo_upload_pack.go
index 4b75910..a19b081 100644
--- a/http_handle_repo_upload_pack.go
+++ b/http_handle_repo_upload_pack.go
@@ -3,6 +3,7 @@ package main
import (
"io"
"net/http"
+ "os"
"os/exec"
)
@@ -20,6 +21,7 @@ func handle_upload_pack(w http.ResponseWriter, r *http.Request, params map[strin
w.WriteHeader(http.StatusOK)
cmd := exec.Command("git", "upload-pack", "--stateless-rpc", repo_path)
+ cmd.Env = append(os.Environ(), "LINDENII_FORGE_HOOKS_SOCKET_PATH="+config.Hooks.Socket)
stdout, err := cmd.StdoutPipe()
if err != nil {
return err
diff --git a/ssh_handle_receive_pack.go b/ssh_handle_receive_pack.go
index 2bf28b8..58f99da 100644
--- a/ssh_handle_receive_pack.go
+++ b/ssh_handle_receive_pack.go
@@ -3,6 +3,7 @@ package main
import (
"errors"
"fmt"
+ "os"
"os/exec"
glider_ssh "github.com/gliderlabs/ssh"
@@ -20,6 +21,7 @@ func ssh_handle_receive_pack(session glider_ssh.Session, pubkey string, repo_ide
}
proc := exec.CommandContext(session.Context(), "git-receive-pack", repo_path)
+ proc.Env = append(os.Environ(), "LINDENII_FORGE_HOOKS_SOCKET_PATH="+config.Hooks.Socket)
proc.Stdin = session
proc.Stdout = session
proc.Stderr = session.Stderr()
diff --git a/ssh_handle_upload_pack.go b/ssh_handle_upload_pack.go
index 3cc3bb2..ac52e5c 100644
--- a/ssh_handle_upload_pack.go
+++ b/ssh_handle_upload_pack.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "os"
"os/exec"
glider_ssh "github.com/gliderlabs/ssh"
@@ -14,6 +15,7 @@ func ssh_handle_upload_pack(session glider_ssh.Session, pubkey string, repo_iden
}
proc := exec.CommandContext(session.Context(), "git-upload-pack", repo_path)
+ proc.Env = append(os.Environ(), "LINDENII_FORGE_HOOKS_SOCKET_PATH="+config.Hooks.Socket)
proc.Stdin = session
proc.Stdout = session
proc.Stderr = session.Stderr()