diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-12-10 23:46:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 23:46:47 +0100 |
commit | 94ddfeb46ae98274afb8089f2bedfe48ee90b3b9 (patch) | |
tree | af8c16b7cba5afdb192a7e5b9b967e0f12db2227 /storage/filesystem/dotgit/dotgit_test.go | |
parent | 443abf89696c62d46e0c3e567c8ba380ff974d0d (diff) | |
parent | 681855bf2cccd9afa85f50fa0e2ae9e05b54d3b5 (diff) | |
download | go-git-94ddfeb46ae98274afb8089f2bedfe48ee90b3b9.tar.gz |
Merge pull request #1036 from jfontan/fix/capabilities-setref
storage/dotgit: use fs capabilities in setRef
Diffstat (limited to 'storage/filesystem/dotgit/dotgit_test.go')
-rw-r--r-- | storage/filesystem/dotgit/dotgit_test.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/storage/filesystem/dotgit/dotgit_test.go b/storage/filesystem/dotgit/dotgit_test.go index 308c6b7..73b0291 100644 --- a/storage/filesystem/dotgit/dotgit_test.go +++ b/storage/filesystem/dotgit/dotgit_test.go @@ -57,11 +57,26 @@ func (s *SuiteDotGit) TestSetRefs(c *C) { fs := osfs.New(tmp) dir := New(fs) + testSetRefs(c, dir) +} + +func (s *SuiteDotGit) TestSetRefsNorwfs(c *C) { + tmp, err := ioutil.TempDir("", "dot-git") + c.Assert(err, IsNil) + defer os.RemoveAll(tmp) + + fs := osfs.New(tmp) + dir := New(&norwfs{fs}) + + testSetRefs(c, dir) +} + +func testSetRefs(c *C, dir *DotGit) { firstFoo := plumbing.NewReferenceFromStrings( "refs/heads/foo", "e8d3ffab552895c19b9fcf7aa264d277cde33881", ) - err = dir.SetRef(firstFoo, nil) + err := dir.SetRef(firstFoo, nil) c.Assert(err, IsNil) @@ -795,3 +810,11 @@ func (s *SuiteDotGit) TestAlternates(c *C) { } c.Assert(dotgits[1].fs.Root(), Equals, expectedPath) } + +type norwfs struct { + billy.Filesystem +} + +func (f *norwfs) Capabilities() billy.Capability { + return billy.Capabilities(f.Filesystem) &^ billy.ReadAndWriteCapability +} |