aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/dotgit/dotgit_test.go
diff options
context:
space:
mode:
authornoxora <ldecker@indeed.com>2018-08-14 14:02:26 -0500
committernoxora <ldecker@indeed.com>2018-08-16 10:40:52 -0500
commitae5501623169ec981091a5f1cfb56ab8e7688031 (patch)
tree8448e04029d2123430a4f5c894480c7dd8571547 /storage/filesystem/dotgit/dotgit_test.go
parent3bd5e82b2512d85becae9677fa06b5a973fd4cfb (diff)
downloadgo-git-ae5501623169ec981091a5f1cfb56ab8e7688031.tar.gz
added hook support
Signed-off-by: noxora <ldecker@indeed.com> trying a possible fix to the delete test Signed-off-by: noxora <ldecker@indeed.com> still trying to fix this test Signed-off-by: noxora <ldecker@indeed.com> fixes did not work, seems to be a windows env problem Signed-off-by: noxora <ldecker@indeed.com>
Diffstat (limited to 'storage/filesystem/dotgit/dotgit_test.go')
-rw-r--r--storage/filesystem/dotgit/dotgit_test.go49
1 files changed, 48 insertions, 1 deletions
diff --git a/storage/filesystem/dotgit/dotgit_test.go b/storage/filesystem/dotgit/dotgit_test.go
index 7733eef..ce30500 100644
--- a/storage/filesystem/dotgit/dotgit_test.go
+++ b/storage/filesystem/dotgit/dotgit_test.go
@@ -9,11 +9,11 @@ import (
"strings"
"testing"
+ fixtures "gopkg.in/src-d/go-git-fixtures.v3"
"gopkg.in/src-d/go-git.v4/plumbing"
. "gopkg.in/check.v1"
"gopkg.in/src-d/go-billy.v4/osfs"
- "gopkg.in/src-d/go-git-fixtures.v3"
)
func Test(t *testing.T) { TestingT(t) }
@@ -537,6 +537,53 @@ func (s *SuiteDotGit) TestObject(c *C) {
file.Name(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")),
Equals, true,
)
+ incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
+ incomingDirPath := fs.Join("objects", "incoming-123456")
+ incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
+ fs.MkdirAll(incomingDirPath, os.FileMode(0755))
+ fs.Create(incomingFilePath)
+
+ file, err = dir.Object(plumbing.NewHash(incomingHash))
+ c.Assert(err, IsNil)
+}
+
+func (s *SuiteDotGit) TestObjectStat(c *C) {
+ fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
+ dir := New(fs)
+
+ hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
+ _, err := dir.ObjectStat(hash)
+ c.Assert(err, IsNil)
+ incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
+ incomingDirPath := fs.Join("objects", "incoming-123456")
+ incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
+ fs.MkdirAll(incomingDirPath, os.FileMode(0755))
+ fs.Create(incomingFilePath)
+
+ _, err = dir.ObjectStat(plumbing.NewHash(incomingHash))
+ c.Assert(err, IsNil)
+}
+
+func (s *SuiteDotGit) TestObjectDelete(c *C) {
+ fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
+ dir := New(fs)
+
+ hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
+ err := dir.ObjectDelete(hash)
+ c.Assert(err, IsNil)
+ //incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
+ //incomingDirPath := fs.Join("objects", "incoming-123456")
+ //incomingSubDirPath := fs.Join(incomingDirPath, incomingHash[0:2])
+ //incomingFilePath := fs.Join(incomingDirPath, incomingHash[2:40])
+ //err = fs.MkdirAll(incomingDirPath, os.FileMode(0755))
+ //c.Assert(err, IsNil)
+ //err = fs.MkdirAll(incomingSubDirPath, os.FileMode(0755))
+ //c.Assert(err, IsNil)
+ //_, err = fs.Create(incomingFilePath)
+ //c.Assert(err, IsNil)
+
+ //err = dir.ObjectDelete(plumbing.NewHash(incomingHash))
+ //c.Assert(err, IsNil)
}
func (s *SuiteDotGit) TestObjectNotFound(c *C) {