1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package file
import (
"os"
"os/exec"
"path/filepath"
"gopkg.in/src-d/go-git.v4/fixtures"
. "gopkg.in/check.v1"
"io/ioutil"
)
type CommonSuite struct {
fixtures.Suite
ReceivePackBin string
UploadPackBin string
}
var _ = Suite(&CommonSuite{})
func (s *CommonSuite) SetUpSuite(c *C) {
s.Suite.SetUpSuite(c)
if err := exec.Command("git", "--version").Run(); err != nil {
c.Skip("git command not found")
}
binDir, err := ioutil.TempDir(os.TempDir(), "")
c.Assert(err, IsNil)
s.ReceivePackBin = filepath.Join(binDir, "git-receive-pack")
s.UploadPackBin = filepath.Join(binDir, "git-upload-pack")
bin := filepath.Join(binDir, "go-git")
cmd := exec.Command("go", "build", "-o", bin,
"../../../cli/go-git/...")
c.Assert(cmd.Run(), IsNil)
c.Assert(os.Symlink(bin, s.ReceivePackBin), IsNil)
c.Assert(os.Symlink(bin, s.UploadPackBin), IsNil)
}
|