aboutsummaryrefslogtreecommitdiffstats
path: root/fixtures
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-12-06 15:46:09 +0100
committerGitHub <noreply@github.com>2016-12-06 15:46:09 +0100
commit22fe81f342538ae51442a72356036768f7f1a2f9 (patch)
treeccfe9fcd48d3c8f349b42413f71f26ba23a4cba9 /fixtures
parent4b5849db76905830e0124b6b9f4294ee13308e0f (diff)
downloadgo-git-22fe81f342538ae51442a72356036768f7f1a2f9.tar.gz
protocol/packp: UploadPackResponse implementation (#161)
* plumbing/protocol: paktp avoid duplication of haves, wants and shallow * protocol/pakp: UploadPackResponse implementation * changes * changes * changes * debug * changes
Diffstat (limited to 'fixtures')
-rw-r--r--fixtures/fixtures.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/fixtures/fixtures.go b/fixtures/fixtures.go
index 503f2ea..7cfceae 100644
--- a/fixtures/fixtures.go
+++ b/fixtures/fixtures.go
@@ -3,6 +3,7 @@ package fixtures
import (
"fmt"
"go/build"
+ "io/ioutil"
"os"
"path/filepath"
@@ -195,6 +196,25 @@ func (f *Fixture) DotGit() fs.Filesystem {
return osfs.New(path)
}
+func (f *Fixture) Worktree() fs.Filesystem {
+ fn := filepath.Join(RootFolder, DataFolder, fmt.Sprintf("git-%s.tgz", f.DotGitHash))
+ git, err := tgz.Extract(fn)
+ if err != nil {
+ panic(err)
+ }
+
+ worktree, err := ioutil.TempDir("", "worktree")
+ if err != nil {
+ panic(err)
+ }
+
+ if err := os.Rename(git, filepath.Join(worktree, ".git")); err != nil {
+ panic(err)
+ }
+
+ return osfs.New(worktree)
+}
+
type Fixtures []*Fixture
func (g Fixtures) Test(c *check.C, test func(*Fixture)) {