aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-07-04 10:57:33 +0200
committerAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-07-04 11:17:34 +0200
commit97aa370451441a553b4b04f5fa3bdb8a42fead26 (patch)
treef118981d65d1b2d25c00795489bdd8f5f67772be /plumbing/transport
parent06f26e2d7096a7e8458e9e9b41e05c8bb83babf6 (diff)
downloadgo-git-97aa370451441a553b4b04f5fa3bdb8a42fead26.tar.gz
fix CGI git server
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/http/receive_pack_test.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/plumbing/transport/http/receive_pack_test.go b/plumbing/transport/http/receive_pack_test.go
index afc97b6..101a5b7 100644
--- a/plumbing/transport/http/receive_pack_test.go
+++ b/plumbing/transport/http/receive_pack_test.go
@@ -9,6 +9,7 @@ import (
"net/http"
"net/http/cgi"
"os"
+ "os/exec"
"path/filepath"
"strings"
@@ -43,7 +44,7 @@ func (s *ReceivePackSuite) SetUpTest(c *C) {
err = os.MkdirAll(interpolatedBase, 0755)
c.Assert(err, IsNil)
- dotgit := fixtures.Basic().One().DotGit().Base()
+ dotgit := fixtures.Basic().One().DotGit().Root()
prepareRepo(c, dotgit)
err = os.Rename(dotgit, filepath.Join(interpolatedBase, "basic.git"))
c.Assert(err, IsNil)
@@ -52,7 +53,7 @@ func (s *ReceivePackSuite) SetUpTest(c *C) {
c.Assert(err, IsNil)
s.ReceivePackSuite.Endpoint = ep
- dotgit = fixtures.ByTag("empty").One().DotGit().Base()
+ dotgit = fixtures.ByTag("empty").One().DotGit().Root()
prepareRepo(c, dotgit)
err = os.Rename(dotgit, filepath.Join(interpolatedBase, "empty.git"))
c.Assert(err, IsNil)
@@ -61,17 +62,23 @@ func (s *ReceivePackSuite) SetUpTest(c *C) {
c.Assert(err, IsNil)
s.ReceivePackSuite.EmptyEndpoint = ep
- ep, err = transport.NewEndpoint(fmt.Sprintf("git://localhost:%d/non-existent.git", port))
+ ep, err = transport.NewEndpoint(fmt.Sprintf("http://localhost:%d/non-existent.git", port))
c.Assert(err, IsNil)
s.ReceivePackSuite.NonExistentEndpoint = ep
- var h http.Handler = &cgi.Handler{
- Path: "/usr/lib/git-core/git-http-backend",
+ cmd := exec.Command("git", "--exec-path")
+ out, err := cmd.CombinedOutput()
+ c.Assert(err, IsNil)
+ p := filepath.Join(strings.Trim(string(out), "\n"), "git-http-backend")
- Env: []string{"GIT_HTTP_EXPORT_ALL=true", fmt.Sprintf("GIT_PROJECT_ROOT=%s", base)},
+ h := &cgi.Handler{
+ Path: p,
+ Env: []string{"GIT_HTTP_EXPORT_ALL=true", fmt.Sprintf("GIT_PROJECT_ROOT=%s", interpolatedBase)},
}
- go func() { log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), h)) }()
+ go func() {
+ log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), h))
+ }()
}
func (s *ReceivePackSuite) TearDownTest(c *C) {