diff options
author | Alberto Cortés <alberto@sourced.tech> | 2017-03-01 17:33:15 +0100 |
---|---|---|
committer | Alberto Cortés <alberto@sourced.tech> | 2017-03-01 17:58:23 +0100 |
commit | da704cfac743a91474baf45df226e5ec034146b0 (patch) | |
tree | 3b64c2706cc515c83dcfd66e31fc6a8cf919bb1c | |
parent | 09e4358e03e5eccf5597be9bdcd3ffeab7618fb2 (diff) | |
download | go-git-da704cfac743a91474baf45df226e5ec034146b0.tar.gz |
replace os.FileMode use with filemode.FileMode
-rw-r--r-- | plumbing/format/index/decoder_test.go | 8 | ||||
-rw-r--r-- | plumbing/format/index/index.go | 4 | ||||
-rw-r--r-- | plumbing/object/change_adaptor_test.go | 20 | ||||
-rw-r--r-- | plumbing/object/change_test.go | 10 | ||||
-rw-r--r-- | plumbing/object/difftree.go | 11 | ||||
-rw-r--r-- | plumbing/object/difftree_test.go | 8 | ||||
-rw-r--r-- | plumbing/object/file.go | 8 | ||||
-rw-r--r-- | plumbing/object/file_test.go | 5 | ||||
-rw-r--r-- | plumbing/object/object_test.go | 5 | ||||
-rw-r--r-- | plumbing/object/tree.go | 44 | ||||
-rw-r--r-- | plumbing/object/tree_test.go | 333 | ||||
-rw-r--r-- | plumbing/object/treenoder.go | 20 | ||||
-rw-r--r-- | worktree.go | 49 | ||||
-rw-r--r-- | worktree_test.go | 6 |
14 files changed, 248 insertions, 283 deletions
diff --git a/plumbing/format/index/decoder_test.go b/plumbing/format/index/decoder_test.go index 1ffbe75..3a6e0d4 100644 --- a/plumbing/format/index/decoder_test.go +++ b/plumbing/format/index/decoder_test.go @@ -3,9 +3,11 @@ package index import ( "testing" - . "gopkg.in/check.v1" - "github.com/src-d/go-git-fixtures" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" + + "github.com/src-d/go-git-fixtures" + . "gopkg.in/check.v1" ) func Test(t *testing.T) { TestingT(t) } @@ -53,7 +55,7 @@ func (s *IndexSuite) TestDecodeEntries(c *C) { c.Assert(e.Size, Equals, uint32(189)) c.Assert(e.Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88") c.Assert(e.Name, Equals, ".gitignore") - c.Assert(e.Mode.String(), Equals, "-rw-r--r--") + c.Assert(e.Mode, Equals, filemode.Regular) e = idx.Entries[1] c.Assert(e.Name, Equals, "CHANGELOG") diff --git a/plumbing/format/index/index.go b/plumbing/format/index/index.go index a95dba2..e706058 100644 --- a/plumbing/format/index/index.go +++ b/plumbing/format/index/index.go @@ -2,10 +2,10 @@ package index import ( "errors" - "os" "time" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" ) var ( @@ -62,7 +62,7 @@ type Entry struct { // Dev and Inode of the tracked path Dev, Inode uint32 // Mode of the path - Mode os.FileMode + Mode filemode.FileMode // UID and GID, userid and group id of the owner UID, GID uint32 // Size is the length in bytes for regular files diff --git a/plumbing/object/change_adaptor_test.go b/plumbing/object/change_adaptor_test.go index fb2636b..b42a3b3 100644 --- a/plumbing/object/change_adaptor_test.go +++ b/plumbing/object/change_adaptor_test.go @@ -1,10 +1,10 @@ package object import ( - "os" "sort" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/storage/filesystem" "srcd.works/go-git.v4/utils/merkletrie" @@ -51,7 +51,7 @@ func newPath(nn ...noder.Noder) noder.Path { return noder.Path(nn) } func (s *ChangeAdaptorSuite) TestTreeNoderHashHasMode(c *C) { hash := plumbing.NewHash("aaaa") - mode := FileMode + mode := filemode.Regular treeNoder := &treeNoder{ hash: hash, @@ -64,8 +64,8 @@ func (s *ChangeAdaptorSuite) TestTreeNoderHashHasMode(c *C) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa4, 0x81, 0x00, 0x00, // object.FileMode in little endian } + expected = append(expected, filemode.Regular.Bytes()...) c.Assert(treeNoder.Hash(), DeepEquals, expected) } @@ -74,7 +74,7 @@ func (s *ChangeAdaptorSuite) TestNewChangeInsert(c *C) { tree := &Tree{} entry := TreeEntry{ Name: "name", - Mode: os.FileMode(42), + Mode: filemode.FileMode(42), Hash: plumbing.NewHash("aaaaa"), } path := newPath(newNoder(tree, entry)) @@ -100,7 +100,7 @@ func (s *ChangeAdaptorSuite) TestNewChangeDelete(c *C) { tree := &Tree{} entry := TreeEntry{ Name: "name", - Mode: os.FileMode(42), + Mode: filemode.FileMode(42), Hash: plumbing.NewHash("aaaaa"), } path := newPath(newNoder(tree, entry)) @@ -126,7 +126,7 @@ func (s *ChangeAdaptorSuite) TestNewChangeModify(c *C) { treeA := &Tree{} entryA := TreeEntry{ Name: "name", - Mode: os.FileMode(42), + Mode: filemode.FileMode(42), Hash: plumbing.NewHash("aaaaa"), } pathA := newPath(newNoder(treeA, entryA)) @@ -136,7 +136,7 @@ func (s *ChangeAdaptorSuite) TestNewChangeModify(c *C) { treeB := &Tree{} entryB := TreeEntry{ Name: "name", - Mode: os.FileMode(42), + Mode: filemode.FileMode(42), Hash: plumbing.NewHash("bbbb"), } pathB := newPath(newNoder(treeB, entryB)) @@ -295,7 +295,7 @@ func (s *ChangeAdaptorSuite) TestChangeEntryFromSortPath(c *C) { tree := &Tree{} entry := TreeEntry{ Name: "name", - Mode: os.FileMode(42), + Mode: filemode.FileMode(42), Hash: plumbing.NewHash("aaaaa"), } path := newPath(newNoder(tree, entry)) @@ -312,14 +312,14 @@ func (s *ChangeAdaptorSuite) TestChangeEntryFromLongPath(c *C) { treeA := &Tree{} entryA := TreeEntry{ Name: "nameA", - Mode: os.FileMode(42), + Mode: filemode.FileMode(42), Hash: plumbing.NewHash("aaaa"), } treeB := &Tree{} entryB := TreeEntry{ Name: "nameB", - Mode: os.FileMode(24), + Mode: filemode.FileMode(24), Hash: plumbing.NewHash("bbbb"), } diff --git a/plumbing/object/change_test.go b/plumbing/object/change_test.go index b47e92a..4a144fa 100644 --- a/plumbing/object/change_test.go +++ b/plumbing/object/change_test.go @@ -1,10 +1,10 @@ package object import ( - "os" "sort" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/storage/filesystem" "srcd.works/go-git.v4/utils/merkletrie" @@ -48,7 +48,7 @@ func (s *ChangeSuite) TestInsert(c *C) { path := "examples/clone/main.go" name := "main.go" - mode := os.FileMode(100644) + mode := filemode.Regular blob := plumbing.NewHash("f95dc8f7923add1a8b9f72ecb1e8db1402de601a") tree := plumbing.NewHash("6efca3ff41cab651332f9ebc0c96bb26be809615") @@ -94,7 +94,7 @@ func (s *ChangeSuite) TestDelete(c *C) { path := "utils/difftree/difftree.go" name := "difftree.go" - mode := os.FileMode(100644) + mode := filemode.Regular blob := plumbing.NewHash("e2cb9a5719daf634d45a063112b4044ee81da13e") tree := plumbing.NewHash("f3d11566401ce4b0808aab9dd6fad3d5abf1481a") @@ -142,7 +142,7 @@ func (s *ChangeSuite) TestModify(c *C) { path := "utils/difftree/difftree.go" name := "difftree.go" - mode := os.FileMode(100644) + mode := filemode.Regular fromBlob := plumbing.NewHash("05f583ace3a9a078d8150905a53a4d82567f125f") fromTree := plumbing.NewHash("b1f01b730b855c82431918cb338ad47ed558999b") toBlob := plumbing.NewHash("de927fad935d172929aacf20e71f3bf0b91dd6f9") @@ -215,7 +215,7 @@ func (s *ChangeSuite) TestErrorsFindingChildsAreDetected(c *C) { path := "utils/difftree/difftree.go" name := "difftree.go" - mode := os.FileMode(100644) + mode := filemode.Regular fromBlob := plumbing.NewHash("aaaa") // does not exists fromTree := plumbing.NewHash("b1f01b730b855c82431918cb338ad47ed558999b") toBlob := plumbing.NewHash("bbbb") // does not exists diff --git a/plumbing/object/difftree.go b/plumbing/object/difftree.go index e6e0cb0..bcc78ad 100644 --- a/plumbing/object/difftree.go +++ b/plumbing/object/difftree.go @@ -2,8 +2,8 @@ package object import ( "bytes" - "os" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/utils/merkletrie" "srcd.works/go-git.v4/utils/merkletrie/noder" ) @@ -49,14 +49,11 @@ func equivalentMode(a, b []byte) bool { } var ( - file = modeToBytes(FileMode) - fileDeprecated = modeToBytes(FileModeDeprecated) - // remove this by fixing plumbing.Object mode ASAP - fileGoGit = modeToBytes(os.FileMode(0644)) + file = filemode.Regular.Bytes() + fileDeprecated = filemode.Deprecated.Bytes() ) func isFilish(b []byte) bool { return bytes.Equal(b, file) || - bytes.Equal(b, fileDeprecated) || - bytes.Equal(b, fileGoGit) + bytes.Equal(b, fileDeprecated) } diff --git a/plumbing/object/difftree_test.go b/plumbing/object/difftree_test.go index 594c49d..fa996c2 100644 --- a/plumbing/object/difftree_test.go +++ b/plumbing/object/difftree_test.go @@ -1,10 +1,10 @@ package object import ( - "os" "sort" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/format/packfile" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/storage/filesystem" @@ -362,11 +362,11 @@ func (s *DiffTreeSuite) TestIssue279(c *C) { // mode to a 100644 or vice versa. from := &treeNoder{ hash: plumbing.NewHash("d08e895238bac36d8220586fdc28c27e1a7a76d3"), - mode: os.FileMode(0100664), + mode: filemode.Regular, } to := &treeNoder{ hash: plumbing.NewHash("d08e895238bac36d8220586fdc28c27e1a7a76d3"), - mode: os.FileMode(0100644), + mode: filemode.Regular, } c.Assert(hashEqual(from, to), Equals, true) c.Assert(hashEqual(to, from), Equals, true) @@ -374,7 +374,7 @@ func (s *DiffTreeSuite) TestIssue279(c *C) { // but should detect if the contents of the file also changed. to = &treeNoder{ hash: plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - mode: os.FileMode(0100644), + mode: filemode.Regular, } c.Assert(hashEqual(from, to), Equals, false) c.Assert(hashEqual(to, from), Equals, false) diff --git a/plumbing/object/file.go b/plumbing/object/file.go index 4866777..5f24cf0 100644 --- a/plumbing/object/file.go +++ b/plumbing/object/file.go @@ -3,9 +3,9 @@ package object import ( "bytes" "io" - "os" "strings" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/utils/ioutil" ) @@ -16,13 +16,13 @@ type File struct { // depending of the function that generates it. Name string // Mode is the file mode. - Mode os.FileMode + Mode filemode.FileMode // Blob with the contents of the file. Blob } // NewFile returns a File based on the given blob object -func NewFile(name string, m os.FileMode, b *Blob) *File { +func NewFile(name string, m filemode.FileMode, b *Blob) *File { return &File{Name: name, Mode: m, Blob: *b} } @@ -81,7 +81,7 @@ func (iter *FileIter) Next() (*File, error) { return nil, err } - if entry.Mode.IsDir() || entry.Mode == SubmoduleMode { + if entry.Mode == filemode.Dir || entry.Mode == filemode.Submodule { continue } diff --git a/plumbing/object/file_test.go b/plumbing/object/file_test.go index c482541..573664b 100644 --- a/plumbing/object/file_test.go +++ b/plumbing/object/file_test.go @@ -3,11 +3,12 @@ package object import ( "io" - "github.com/src-d/go-git-fixtures" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/storage/filesystem" + "github.com/src-d/go-git-fixtures" . "gopkg.in/check.v1" ) @@ -58,7 +59,7 @@ func (s *FileSuite) TestIter(c *C) { exp := t.files[k] file, err := iter.Next() c.Assert(err, IsNil, Commentf("subtest %d, iter %d, err=%v", i, k, err)) - c.Assert(file.Mode.String(), Equals, "-rw-r--r--") + c.Assert(file.Mode, Equals, filemode.Regular) c.Assert(file.Hash.IsZero(), Equals, false) c.Assert(file.Hash, Equals, file.ID()) c.Assert(file.Name, Equals, exp.Name, Commentf("subtest %d, iter %d, name=%s, expected=%s", i, k, file.Name, exp.Hash)) diff --git a/plumbing/object/object_test.go b/plumbing/object/object_test.go index 426baed..46b0065 100644 --- a/plumbing/object/object_test.go +++ b/plumbing/object/object_test.go @@ -6,11 +6,12 @@ import ( "testing" "time" - "github.com/src-d/go-git-fixtures" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/storage/filesystem" + "github.com/src-d/go-git-fixtures" . "gopkg.in/check.v1" ) @@ -91,7 +92,7 @@ func (s *ObjectsSuite) TestParseTree(c *C) { tree.buildMap() c.Assert(tree.m, HasLen, 8) c.Assert(tree.m[".gitignore"].Name, Equals, ".gitignore") - c.Assert(tree.m[".gitignore"].Mode.String(), Equals, "-rw-r--r--") + c.Assert(tree.m[".gitignore"].Mode, Equals, filemode.Regular) c.Assert(tree.m[".gitignore"].Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88") count := 0 diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go index ef5e140..071d064 100644 --- a/plumbing/object/tree.go +++ b/plumbing/object/tree.go @@ -5,12 +5,11 @@ import ( "errors" "fmt" "io" - "os" "path" - "strconv" "strings" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/utils/ioutil" ) @@ -18,13 +17,6 @@ import ( const ( maxTreeDepth = 1024 startingStackSize = 8 - - FileMode os.FileMode = 0100644 - FileModeDeprecated os.FileMode = 0100664 - ExecutableMode os.FileMode = 0100755 - SubmoduleMode os.FileMode = 0160000 - SymlinkMode os.FileMode = 0120000 - TreeMode os.FileMode = 0040000 ) // New errors defined by this package. @@ -68,7 +60,7 @@ func DecodeTree(s storer.EncodedObjectStorer, o plumbing.EncodedObject) (*Tree, // TreeEntry represents a file type TreeEntry struct { Name string - Mode os.FileMode + Mode filemode.FileMode Hash plumbing.Hash } @@ -202,7 +194,7 @@ func (t *Tree) Decode(o plumbing.EncodedObject) (err error) { r := bufio.NewReader(reader) for { - mode, err := r.ReadString(' ') + str, err := r.ReadString(' ') if err != nil { if err == io.EOF { break @@ -210,9 +202,10 @@ func (t *Tree) Decode(o plumbing.EncodedObject) (err error) { return err } + str = str[:len(str)-1] // strip last byte (' ') - fm, err := t.decodeFileMode(mode[:len(mode)-1]) - if err != nil && err != io.EOF { + mode, err := filemode.New(str) + if err != nil { return err } @@ -229,7 +222,7 @@ func (t *Tree) Decode(o plumbing.EncodedObject) (err error) { baseName := name[:len(name)-1] t.Entries = append(t.Entries, TreeEntry{ Hash: hash, - Mode: fm, + Mode: mode, Name: baseName, }) } @@ -237,27 +230,6 @@ func (t *Tree) Decode(o plumbing.EncodedObject) (err error) { return nil } -func (t *Tree) decodeFileMode(mode string) (os.FileMode, error) { - fm, err := strconv.ParseInt(mode, 8, 32) - if err != nil && err != io.EOF { - return 0, err - } - - m := os.FileMode(fm) - switch os.FileMode(fm) { - case FileMode: - m = 0644 - case ExecutableMode: - m = 0755 - case TreeMode: - m = m | os.ModeDir - case SymlinkMode: - m = m | os.ModeSymlink - } - - return m, nil -} - // Encode transforms a Tree into a plumbing.EncodedObject. func (t *Tree) Encode(o plumbing.EncodedObject) error { o.SetType(plumbing.TreeObject) @@ -381,7 +353,7 @@ func (w *TreeWalker) Next() (name string, entry TreeEntry, err error) { return } - if entry.Mode.IsDir() { + if entry.Mode == filemode.Dir { obj, err = GetTree(w.s, entry.Hash) } diff --git a/plumbing/object/tree_test.go b/plumbing/object/tree_test.go index 81fbdec..69c0463 100644 --- a/plumbing/object/tree_test.go +++ b/plumbing/object/tree_test.go @@ -2,15 +2,14 @@ package object import ( "io" - "os" - - fixtures "github.com/src-d/go-git-fixtures" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" + "srcd.works/go-git.v4/plumbing/storer" "srcd.works/go-git.v4/storage/filesystem" + fixtures "github.com/src-d/go-git-fixtures" . "gopkg.in/check.v1" - "srcd.works/go-git.v4/plumbing/storer" ) type TreeSuite struct { @@ -31,10 +30,10 @@ func (s *TreeSuite) TestDecode(c *C) { c.Assert(s.Tree.Entries, HasLen, 8) c.Assert(s.Tree.Entries[0].Name, Equals, ".gitignore") c.Assert(s.Tree.Entries[0].Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88") - c.Assert(s.Tree.Entries[0].Mode, Equals, os.FileMode(0644)) + c.Assert(s.Tree.Entries[0].Mode, Equals, filemode.Regular) c.Assert(s.Tree.Entries[4].Name, Equals, "go") c.Assert(s.Tree.Entries[4].Hash.String(), Equals, "a39771a7651f97faf5c72e08224d857fc35133db") - c.Assert(s.Tree.Entries[4].Mode.String(), Equals, "d---------") + c.Assert(s.Tree.Entries[4].Mode, Equals, filemode.Dir) } func (s *TreeSuite) TestDecodeNonTree(c *C) { @@ -164,9 +163,9 @@ func (s *TreeSuite) TestTreeDecodeEncodeIdempotent(c *C) { trees := []*Tree{ { Entries: []TreeEntry{ - {"foo", os.FileMode(0), plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d")}, - {"bar", os.FileMode(0), plumbing.NewHash("c029517f6300c2da0f4b651b8642506cd6aaf45d")}, - {"baz", os.FileMode(0), plumbing.NewHash("d029517f6300c2da0f4b651b8642506cd6aaf45d")}, + {"foo", filemode.Empty, plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d")}, + {"bar", filemode.Empty, plumbing.NewHash("c029517f6300c2da0f4b651b8642506cd6aaf45d")}, + {"baz", filemode.Empty, plumbing.NewHash("d029517f6300c2da0f4b651b8642506cd6aaf45d")}, }, }, } @@ -233,7 +232,7 @@ func (s *TreeSuite) TestTreeWalkerNext(c *C) { c.Assert(err, IsNil) c.Assert(name, Equals, e.Path) c.Assert(entry.Name, Equals, e.Name) - c.Assert(entry.Mode.String(), Equals, e.Mode) + c.Assert(entry.Mode, Equals, e.Mode) c.Assert(entry.Hash.String(), Equals, e.Hash) c.Assert(walker.Tree().ID().String(), Equals, e.Tree) @@ -305,45 +304,47 @@ func (s *TreeSuite) TestTreeWalkerNextSubmodule(c *C) { } var treeWalkerExpects = []struct { - Path, Mode, Name, Hash, Tree string + Path string + Mode filemode.FileMode + Name, Hash, Tree string }{{ - Path: ".gitignore", Mode: "-rw-r--r--", Name: ".gitignore", + Path: ".gitignore", Mode: filemode.Regular, Name: ".gitignore", Hash: "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "CHANGELOG", Mode: "-rw-r--r--", Name: "CHANGELOG", + Path: "CHANGELOG", Mode: filemode.Regular, Name: "CHANGELOG", Hash: "d3ff53e0564a9f87d8e84b6e28e5060e517008aa", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "LICENSE", Mode: "-rw-r--r--", Name: "LICENSE", + Path: "LICENSE", Mode: filemode.Regular, Name: "LICENSE", Hash: "c192bd6a24ea1ab01d78686e417c8bdc7c3d197f", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "binary.jpg", Mode: "-rw-r--r--", Name: "binary.jpg", + Path: "binary.jpg", Mode: filemode.Regular, Name: "binary.jpg", Hash: "d5c0f4ab811897cadf03aec358ae60d21f91c50d", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "go", Mode: "d---------", Name: "go", + Path: "go", Mode: filemode.Dir, Name: "go", Hash: "a39771a7651f97faf5c72e08224d857fc35133db", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "go/example.go", Mode: "-rw-r--r--", Name: "example.go", + Path: "go/example.go", Mode: filemode.Regular, Name: "example.go", Hash: "880cd14280f4b9b6ed3986d6671f907d7cc2a198", Tree: "a39771a7651f97faf5c72e08224d857fc35133db", }, { - Path: "json", Mode: "d---------", Name: "json", + Path: "json", Mode: filemode.Dir, Name: "json", Hash: "5a877e6a906a2743ad6e45d99c1793642aaf8eda", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "json/long.json", Mode: "-rw-r--r--", Name: "long.json", + Path: "json/long.json", Mode: filemode.Regular, Name: "long.json", Hash: "49c6bb89b17060d7b4deacb7b338fcc6ea2352a9", Tree: "5a877e6a906a2743ad6e45d99c1793642aaf8eda", }, { - Path: "json/short.json", Mode: "-rw-r--r--", Name: "short.json", + Path: "json/short.json", Mode: filemode.Regular, Name: "short.json", Hash: "c8f1d8c61f9da76f4cb49fd86322b6e685dba956", Tree: "5a877e6a906a2743ad6e45d99c1793642aaf8eda", }, { - Path: "php", Mode: "d---------", Name: "php", + Path: "php", Mode: filemode.Dir, Name: "php", Hash: "586af567d0bb5e771e49bdd9434f5e0fb76d25fa", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "php/crappy.php", Mode: "-rw-r--r--", Name: "crappy.php", + Path: "php/crappy.php", Mode: filemode.Regular, Name: "crappy.php", Hash: "9a48f23120e880dfbe41f7c9b7b708e9ee62a492", Tree: "586af567d0bb5e771e49bdd9434f5e0fb76d25fa", }, { - Path: "vendor", Mode: "d---------", Name: "vendor", + Path: "vendor", Mode: filemode.Dir, Name: "vendor", Hash: "cf4aa3b38974fb7d81f367c0830f7d78d65ab86b", Tree: "a8d315b2b1c615d43042c3a62402b8a54288cf5c", }, { - Path: "vendor/foo.go", Mode: "-rw-r--r--", Name: "foo.go", + Path: "vendor/foo.go", Mode: filemode.Regular, Name: "foo.go", Hash: "9dea2395f5403188298c1dabe8bdafe562c491e3", Tree: "cf4aa3b38974fb7d81f367c0830f7d78d65ab86b", }} @@ -925,567 +926,567 @@ func (s *TreeSuite) TestTreeDecodeReadBug(c *C) { expected := &Tree{ Entries: []TreeEntry{ { - Name: "alter.c", Mode: 0644, + Name: "alter.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xa4, 0x9d, 0x33, 0x49, 0xd7, 0xe2, 0x3f, 0xb5, 0x81, 0x19, 0x4f, 0x4c, 0xb5, 0x9a, 0xc0, 0xd5, 0x1b, 0x2, 0x1f, 0x78}, }, { - Name: "analyze.c", Mode: 0644, + Name: "analyze.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x9a, 0x3e, 0x95, 0x97, 0xdb, 0xb, 0x3, 0x20, 0x77, 0xc9, 0x1d, 0x96, 0x9d, 0x22, 0xc6, 0x27, 0x3f, 0x70, 0x2a, 0xc}, }, { - Name: "attach.c", Mode: 0644, + Name: "attach.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xb8, 0xe1, 0x21, 0x99, 0xb5, 0x7d, 0xe8, 0x11, 0xea, 0xe0, 0xd0, 0x61, 0x42, 0xd5, 0xac, 0x4f, 0xd4, 0x30, 0xb1, 0xd8}, }, { - Name: "auth.c", Mode: 0644, + Name: "auth.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd3, 0x8b, 0xb8, 0x36, 0xa7, 0x84, 0xfb, 0xfa, 0xb6, 0xab, 0x7b, 0x3, 0xd4, 0xe6, 0xdd, 0x43, 0xed, 0xc4, 0x1f, 0xa7}, }, { - Name: "backup.c", Mode: 0644, + Name: "backup.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x25, 0x2f, 0x61, 0xcf, 0xca, 0xa8, 0xfc, 0xf3, 0x13, 0x7e, 0x8, 0xed, 0x68, 0x47, 0xdc, 0xfe, 0x1d, 0xc1, 0xde, 0x54}, }, { - Name: "bitvec.c", Mode: 0644, + Name: "bitvec.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x52, 0x18, 0x4a, 0xa9, 0x64, 0xce, 0x18, 0x98, 0xf3, 0x5d, 0x1b, 0x3d, 0x87, 0x87, 0x1c, 0x2d, 0xe, 0xf4, 0xc5, 0x3d}, }, { - Name: "btmutex.c", Mode: 0644, + Name: "btmutex.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd8, 0x7d, 0x4d, 0x5f, 0xee, 0xb6, 0x30, 0x7a, 0xec, 0xdc, 0x9a, 0x83, 0x11, 0x14, 0x89, 0xab, 0x30, 0xc6, 0x78, 0xc3}, }, { - Name: "btree.c", Mode: 0644, + Name: "btree.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x3c, 0xa6, 0x5, 0x83, 0xe3, 0xc8, 0xe3, 0x12, 0x0, 0xf9, 0x73, 0xe0, 0xe9, 0xc4, 0x53, 0x62, 0x58, 0xb2, 0x64, 0x39}, }, { - Name: "btree.h", Mode: 0644, + Name: "btree.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xac, 0xe0, 0xf8, 0xcd, 0x21, 0x77, 0x70, 0xa2, 0xf6, 0x6b, 0x2e, 0xb8, 0x71, 0xbb, 0xc5, 0xfd, 0xc6, 0xfc, 0x2b, 0x68}, }, { - Name: "btreeInt.h", Mode: 0644, + Name: "btreeInt.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xce, 0x3c, 0x54, 0x93, 0xf8, 0xca, 0xd0, 0xbc, 0x54, 0x8a, 0xe8, 0xe4, 0x4e, 0x51, 0x28, 0x31, 0xd8, 0xfa, 0xc4, 0x31}, }, { - Name: "build.c", Mode: 0644, + Name: "build.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x3c, 0x91, 0xcd, 0xcf, 0xdb, 0x7b, 0x1, 0x7c, 0xbc, 0x2d, 0x5c, 0x29, 0x57, 0x1a, 0x98, 0x27, 0xd, 0xe0, 0x71, 0xe6}, }, { - Name: "callback.c", Mode: 0644, + Name: "callback.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd4, 0xc, 0x65, 0xcb, 0x92, 0x45, 0x80, 0x29, 0x6a, 0xd0, 0x69, 0xa0, 0x4b, 0xf9, 0xc9, 0xe9, 0x53, 0x4e, 0xca, 0xa7}, }, { - Name: "complete.c", Mode: 0644, + Name: "complete.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x9e, 0x91, 0x40, 0x8, 0x5c, 0x0, 0x46, 0xed, 0x3b, 0xf6, 0xf4, 0x48, 0x52, 0x20, 0x69, 0x2d, 0xca, 0x17, 0x43, 0xc5}, }, { - Name: "crypto.c", Mode: 0644, + Name: "crypto.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x25, 0x51, 0xe6, 0xba, 0x2, 0x39, 0xf8, 0x5a, 0x35, 0x77, 0x96, 0xa8, 0xdd, 0xa8, 0xca, 0x3e, 0x29, 0x70, 0x93, 0xf8}, }, { - Name: "crypto.h", Mode: 0644, + Name: "crypto.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xf7, 0x1f, 0x53, 0x2c, 0xdc, 0x44, 0x8f, 0xa, 0x1d, 0xd5, 0xc6, 0xef, 0xf5, 0xfb, 0xd3, 0x3a, 0x91, 0x55, 0xaa, 0x97}, }, { - Name: "crypto_cc.c", Mode: 0644, + Name: "crypto_cc.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x53, 0x7d, 0xf7, 0xe3, 0xb3, 0x6a, 0xb5, 0xcf, 0xdd, 0x6f, 0xca, 0x40, 0x28, 0xeb, 0xca, 0xe1, 0x86, 0x87, 0xd6, 0x4d}, }, { - Name: "crypto_impl.c", Mode: 0644, + Name: "crypto_impl.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xa5, 0x89, 0x27, 0xc7, 0x6e, 0xf6, 0x20, 0x56, 0x77, 0xbe, 0x5c, 0x1a, 0x8e, 0x80, 0xc9, 0x83, 0x56, 0xb3, 0xa9, 0xd3}, }, { - Name: "crypto_libtomcrypt.c", Mode: 0644, + Name: "crypto_libtomcrypt.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x1a, 0x33, 0x83, 0xe0, 0x1, 0xa7, 0x21, 0x11, 0xc3, 0xf6, 0x61, 0x92, 0x22, 0xb0, 0x65, 0xf4, 0xbd, 0x1, 0xb, 0xe1}, }, { - Name: "crypto_openssl.c", Mode: 0644, + Name: "crypto_openssl.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd0, 0x19, 0x81, 0x3b, 0x47, 0x6c, 0x52, 0xd0, 0x20, 0xe2, 0xc0, 0xac, 0xd5, 0x24, 0xe9, 0xea, 0x3d, 0xf, 0xb9, 0xfe}, }, { - Name: "ctime.c", Mode: 0644, + Name: "ctime.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x60, 0x59, 0x5f, 0xf8, 0x8d, 0x92, 0xf7, 0x8, 0x26, 0x4, 0xfb, 0xd9, 0xdf, 0x9a, 0xfe, 0xa1, 0x6a, 0xe8, 0x6f, 0xf}, }, { - Name: "date.c", Mode: 0644, + Name: "date.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x75, 0x8d, 0xd7, 0xc8, 0x9b, 0xca, 0x39, 0x37, 0xa9, 0xd, 0x70, 0x6e, 0xa9, 0x82, 0xce, 0x3a, 0xcf, 0x11, 0xd1, 0x83}, }, { - Name: "delete.c", Mode: 0644, + Name: "delete.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x63, 0x4e, 0x11, 0x55, 0x63, 0xae, 0x12, 0xba, 0x65, 0x58, 0xcc, 0xc5, 0x12, 0xae, 0xd6, 0x31, 0xc0, 0x66, 0xba, 0xd8}, }, { - Name: "expr.c", Mode: 0644, + Name: "expr.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x66, 0x3, 0x97, 0xe0, 0x78, 0xae, 0x48, 0xb2, 0xe7, 0x17, 0x5e, 0x33, 0x85, 0x67, 0x78, 0x19, 0x72, 0x2d, 0xdd, 0x6c}, }, { - Name: "fault.c", Mode: 0644, + Name: "fault.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xc3, 0x2, 0x8c, 0x4f, 0x93, 0x6e, 0xdf, 0x96, 0x71, 0x2d, 0xbe, 0x73, 0xa0, 0x76, 0x62, 0xf0, 0xa2, 0x6b, 0x1d, 0xa}, }, { - Name: "fkey.c", Mode: 0644, + Name: "fkey.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xac, 0x35, 0xbc, 0x19, 0x4c, 0xde, 0xb1, 0x27, 0x98, 0x9b, 0x9, 0x40, 0x35, 0xce, 0xe0, 0x6f, 0x57, 0x37, 0x6f, 0x5e}, }, { - Name: "func.c", Mode: 0644, + Name: "func.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xc0, 0x2f, 0x9, 0x6a, 0xda, 0xd5, 0xbc, 0xe9, 0xac, 0x83, 0xd3, 0x5f, 0xf, 0x46, 0x9, 0xd6, 0xf6, 0xd4, 0x3b, 0xe5}, }, { - Name: "global.c", Mode: 0644, + Name: "global.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x7b, 0x2, 0xcf, 0x21, 0x30, 0xe0, 0xd1, 0xa7, 0xb8, 0x89, 0xd8, 0x44, 0xc, 0xcc, 0x82, 0x8, 0xf7, 0xb6, 0x7b, 0xf9}, }, { - Name: "hash.c", Mode: 0644, + Name: "hash.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe8, 0x1d, 0xcf, 0x95, 0xe4, 0x38, 0x48, 0xfa, 0x70, 0x86, 0xb7, 0xf7, 0x81, 0xc0, 0x90, 0xad, 0xc7, 0xe6, 0xca, 0x8e}, }, { - Name: "hash.h", Mode: 0644, + Name: "hash.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x82, 0xb7, 0xc5, 0x8c, 0x71, 0x9, 0xb, 0x54, 0x7e, 0x10, 0x17, 0x42, 0xaa, 0x9, 0x51, 0x73, 0x9f, 0xf2, 0xee, 0xe7}, }, { - Name: "hwtime.h", Mode: 0644, + Name: "hwtime.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xb8, 0xbc, 0x5a, 0x29, 0x5b, 0xe3, 0xfa, 0xc8, 0x35, 0x1f, 0xa9, 0xf0, 0x8a, 0x77, 0x57, 0x9d, 0x59, 0xc9, 0xa8, 0xe4}, }, { - Name: "insert.c", Mode: 0644, + Name: "insert.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x9a, 0x56, 0x61, 0xf5, 0x9a, 0x72, 0x95, 0x2b, 0xe6, 0xc1, 0x67, 0xa0, 0xc2, 0xdb, 0x15, 0x9b, 0x91, 0xb7, 0x1f, 0xae}, }, { - Name: "journal.c", Mode: 0644, + Name: "journal.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xfe, 0xd2, 0x7b, 0xe3, 0xe3, 0x80, 0x55, 0xd2, 0x20, 0x43, 0x95, 0xcd, 0xe6, 0xff, 0xc9, 0x45, 0x89, 0xfb, 0xf5, 0xe8}, }, { - Name: "legacy.c", Mode: 0644, + Name: "legacy.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x94, 0x64, 0x9a, 0xe7, 0x5, 0xab, 0x93, 0x85, 0x10, 0x8d, 0xd, 0x88, 0x7a, 0xf0, 0x75, 0x92, 0x89, 0xfb, 0x23, 0xcb}, }, { - Name: "lempar.c", Mode: 0644, + Name: "lempar.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x2a, 0xfa, 0xa6, 0xce, 0xa6, 0xd8, 0x29, 0x60, 0x2c, 0x27, 0x86, 0xc1, 0xf8, 0xa3, 0x7f, 0x56, 0x7c, 0xf6, 0xfd, 0x53}, }, { - Name: "loadext.c", Mode: 0644, + Name: "loadext.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xcd, 0xcf, 0x6a, 0x93, 0xb8, 0xc4, 0xf, 0x91, 0x4b, 0x94, 0x24, 0xe, 0xf1, 0x4c, 0xb4, 0xa3, 0xa, 0x37, 0xec, 0xa1}, }, { - Name: "main.c", Mode: 0644, + Name: "main.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x39, 0xf6, 0x4, 0x21, 0xe6, 0x81, 0x27, 0x7c, 0xc3, 0xdb, 0xa0, 0x9a, 0xbe, 0x7c, 0xf7, 0x90, 0xd5, 0x28, 0xf5, 0xc3}, }, { - Name: "malloc.c", Mode: 0644, + Name: "malloc.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x35, 0xa4, 0x4e, 0x5f, 0x61, 0xc2, 0xe4, 0x4c, 0x48, 0x1c, 0x62, 0x51, 0xbd, 0xa, 0xae, 0x7a, 0xcd, 0xa4, 0xde, 0xb}, }, { - Name: "mem0.c", Mode: 0644, + Name: "mem0.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd, 0xb, 0x66, 0x67, 0xd6, 0xa, 0x95, 0x5a, 0x6, 0x96, 0xdf, 0x62, 0x89, 0xb4, 0x91, 0x78, 0x96, 0x93, 0x43, 0xaa}, }, { - Name: "mem1.c", Mode: 0644, + Name: "mem1.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x35, 0x78, 0x49, 0x6f, 0x33, 0x3, 0x7, 0xb2, 0x31, 0xdf, 0xb5, 0x3c, 0xc, 0x2e, 0x1c, 0x6b, 0x32, 0x3d, 0x79, 0x1e}, }, { - Name: "mem2.c", Mode: 0644, + Name: "mem2.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x26, 0x44, 0x8e, 0xa8, 0xaa, 0xe0, 0x36, 0x6a, 0xf0, 0x54, 0x1a, 0xfe, 0xa4, 0x79, 0xb, 0x42, 0xf4, 0xa6, 0x9b, 0x5a}, }, { - Name: "mem3.c", Mode: 0644, + Name: "mem3.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x1a, 0x1b, 0x79, 0x1f, 0x28, 0xf8, 0xcf, 0x3c, 0xe4, 0xf9, 0xa3, 0x5c, 0xda, 0xd7, 0xb7, 0x10, 0x75, 0x68, 0xc7, 0x15}, }, { - Name: "mem5.c", Mode: 0644, + Name: "mem5.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x78, 0x3c, 0xef, 0x61, 0x76, 0xc5, 0x9c, 0xbf, 0x30, 0x91, 0x46, 0x31, 0x9, 0x5a, 0x1a, 0x54, 0xf4, 0xe4, 0x2e, 0x8}, }, { - Name: "memjournal.c", Mode: 0644, + Name: "memjournal.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x5, 0x72, 0x59, 0x48, 0xf6, 0x5d, 0x42, 0x7b, 0x7, 0xf7, 0xf9, 0x29, 0xac, 0xa3, 0xff, 0x22, 0x4b, 0x17, 0x53, 0xdf}, }, { - Name: "mutex.c", Mode: 0644, + Name: "mutex.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xb5, 0x67, 0xe7, 0xc2, 0x7e, 0xf2, 0x4, 0x10, 0x86, 0xaf, 0xe0, 0xf6, 0x96, 0x66, 0xe2, 0x7b, 0xf5, 0x9, 0x8a, 0x59}, }, { - Name: "mutex.h", Mode: 0644, + Name: "mutex.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x9, 0x78, 0x81, 0x22, 0x52, 0x77, 0x89, 0xa, 0x9c, 0x36, 0xc2, 0x4d, 0x41, 0xf6, 0x11, 0x4d, 0x64, 0xc0, 0x6d, 0xb3}, }, { - Name: "mutex_noop.c", Mode: 0644, + Name: "mutex_noop.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x45, 0x6e, 0x82, 0xa2, 0x5e, 0x27, 0x1b, 0x6, 0x14, 0xe7, 0xf4, 0xf8, 0x3c, 0x22, 0x85, 0x53, 0xb7, 0xfa, 0x1, 0x58}, }, { - Name: "mutex_unix.c", Mode: 0644, + Name: "mutex_unix.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xec, 0xa7, 0x29, 0x58, 0x31, 0xc2, 0xf0, 0xee, 0x48, 0xba, 0x54, 0xd0, 0x62, 0x91, 0x4d, 0x6, 0xa1, 0xdd, 0x8e, 0xbe}, }, { - Name: "mutex_w32.c", Mode: 0644, + Name: "mutex_w32.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x27, 0xd1, 0xa, 0xf5, 0xbd, 0x33, 0x1b, 0xdb, 0x97, 0x3f, 0x61, 0x45, 0xb7, 0x4f, 0x72, 0xb6, 0x7, 0xcf, 0xc4, 0x6e}, }, { - Name: "notify.c", Mode: 0644, + Name: "notify.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xfc, 0xab, 0x5b, 0xfa, 0xf0, 0x19, 0x8, 0xd3, 0xde, 0x93, 0xfa, 0x88, 0xb5, 0xea, 0xe9, 0xe9, 0x6c, 0xa3, 0xc8, 0xe8}, }, { - Name: "os.c", Mode: 0644, + Name: "os.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xbe, 0x2e, 0xa4, 0xcf, 0xc0, 0x19, 0x59, 0x93, 0xa3, 0x40, 0xc9, 0x2, 0xae, 0xdd, 0xf1, 0xbe, 0x4b, 0x8e, 0xd7, 0x3a}, }, { - Name: "os.h", Mode: 0644, + Name: "os.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x7, 0xa, 0x2d, 0xdd, 0x17, 0xf7, 0x71, 0xf9, 0x8f, 0xf8, 0xcc, 0xd6, 0xf0, 0x33, 0xbd, 0xac, 0xc5, 0xe9, 0xf6, 0xc}, }, { - Name: "os_common.h", Mode: 0644, + Name: "os_common.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xf6, 0xc3, 0xe7, 0xff, 0x89, 0x46, 0x30, 0x86, 0x40, 0x18, 0x22, 0xf4, 0x81, 0xe7, 0xe3, 0xb8, 0x7b, 0x2c, 0x78, 0xc7}, }, { - Name: "os_unix.c", Mode: 0644, + Name: "os_unix.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xab, 0xc2, 0x3a, 0x45, 0x2e, 0x72, 0xf7, 0x1c, 0x76, 0xaf, 0xa9, 0x98, 0x3c, 0x3a, 0xd9, 0xd4, 0x25, 0x61, 0x6c, 0x6d}, }, { - Name: "os_win.c", Mode: 0644, + Name: "os_win.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xae, 0xb0, 0x88, 0x14, 0xb3, 0xda, 0xbe, 0x81, 0xb8, 0x4c, 0xda, 0x91, 0x85, 0x82, 0xb0, 0xf, 0xfd, 0x86, 0xe4, 0x87}, }, { - Name: "pager.c", Mode: 0644, + Name: "pager.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x61, 0x72, 0x7f, 0xaa, 0x9c, 0xf, 0x3d, 0x56, 0x62, 0x65, 0xbe, 0x7e, 0xec, 0x5b, 0x2a, 0x35, 0xf6, 0xa4, 0xbc, 0x9f}, }, { - Name: "pager.h", Mode: 0644, + Name: "pager.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x6f, 0x65, 0x91, 0x36, 0xe2, 0x76, 0x7, 0x9d, 0xa4, 0x3a, 0x2e, 0x39, 0xe1, 0xb6, 0x86, 0x37, 0xec, 0xad, 0xcf, 0x68}, }, { - Name: "parse.y", Mode: 0644, + Name: "parse.y", Mode: filemode.Regular, Hash: plumbing.Hash{0x83, 0x10, 0xb2, 0x69, 0x89, 0xb0, 0x5b, 0xed, 0x1e, 0x1b, 0x3, 0xda, 0x80, 0xf5, 0xc0, 0xa5, 0x2e, 0x9a, 0xd1, 0xd2}, }, { - Name: "pcache.c", Mode: 0644, + Name: "pcache.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x48, 0x2a, 0x18, 0x8b, 0xee, 0x19, 0x91, 0xbc, 0x8a, 0xda, 0xc9, 0x6a, 0x19, 0x3a, 0x53, 0xe5, 0x46, 0x2a, 0x8c, 0x10}, }, { - Name: "pcache.h", Mode: 0644, + Name: "pcache.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xf4, 0xd4, 0xad, 0x71, 0xc1, 0xd, 0x78, 0xc6, 0xda, 0xbd, 0xe2, 0x52, 0x15, 0xcd, 0x41, 0x5a, 0x76, 0x1, 0x48, 0xca}, }, { - Name: "pcache1.c", Mode: 0644, + Name: "pcache1.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x41, 0x47, 0xd2, 0xef, 0xf5, 0x5b, 0xdd, 0x9f, 0xf7, 0xc6, 0x86, 0xc, 0x60, 0x18, 0x10, 0x20, 0x16, 0x6c, 0x5f, 0x50}, }, { - Name: "pragma.c", Mode: 0644, + Name: "pragma.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x22, 0x97, 0x71, 0x69, 0x61, 0x7d, 0x49, 0x22, 0xb3, 0x99, 0x3f, 0x76, 0x9d, 0x90, 0xfa, 0x7b, 0xc4, 0x41, 0xea, 0x50}, }, { - Name: "prepare.c", Mode: 0644, + Name: "prepare.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd7, 0x8d, 0x83, 0xcb, 0xd8, 0x78, 0x97, 0xf5, 0x73, 0x30, 0x3f, 0x9f, 0x57, 0xab, 0x8d, 0xe0, 0x24, 0xa6, 0xe3, 0xf8}, }, { - Name: "printf.c", Mode: 0644, + Name: "printf.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x9f, 0x68, 0xd2, 0x4, 0xff, 0xdc, 0x9f, 0x3d, 0x42, 0x7f, 0x80, 0xa8, 0x23, 0x9a, 0x7f, 0xa3, 0xa9, 0x8a, 0xec, 0xbd}, }, { - Name: "random.c", Mode: 0644, + Name: "random.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x23, 0x4e, 0xbd, 0xf6, 0x58, 0xf4, 0x36, 0xcc, 0x7c, 0x68, 0xf0, 0x27, 0xc4, 0x8b, 0xe, 0x1b, 0x9b, 0xa3, 0x4e, 0x98}, }, { - Name: "resolve.c", Mode: 0644, + Name: "resolve.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x91, 0xef, 0xca, 0xa1, 0xa1, 0x6b, 0xfc, 0x98, 0xfb, 0x35, 0xd8, 0x5c, 0xad, 0x15, 0x6b, 0x93, 0x53, 0x3e, 0x4e, 0x6}, }, { - Name: "rowset.c", Mode: 0644, + Name: "rowset.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x57, 0x61, 0xf9, 0x85, 0x50, 0xb1, 0x76, 0xcc, 0xe1, 0x1d, 0xcb, 0xce, 0xc9, 0x38, 0x99, 0xa0, 0x75, 0xbb, 0x64, 0xfd}, }, { - Name: "select.c", Mode: 0644, + Name: "select.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xf3, 0xf1, 0x49, 0x9, 0x63, 0x95, 0x5b, 0x8e, 0xd0, 0xc9, 0xfe, 0x6e, 0x1e, 0xec, 0x83, 0x6c, 0x1a, 0x52, 0x94, 0xb4}, }, { - Name: "shell.c", Mode: 0644, + Name: "shell.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x1b, 0xe2, 0x87, 0x1f, 0xed, 0x9a, 0x1f, 0xdf, 0x1d, 0xf7, 0x19, 0x8e, 0x11, 0x25, 0x36, 0x0, 0xec, 0xba, 0x76, 0xcc}, }, { - Name: "sqlcipher.h", Mode: 0644, + Name: "sqlcipher.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x82, 0x75, 0x30, 0x95, 0xcd, 0x17, 0x23, 0xc5, 0xff, 0x4f, 0x11, 0x15, 0xe4, 0x97, 0x55, 0x91, 0xee, 0x34, 0xf5, 0xce}, }, { - Name: "sqlite.h.in", Mode: 0644, + Name: "sqlite.h.in", Mode: filemode.Regular, Hash: plumbing.Hash{0x66, 0x8, 0x82, 0x31, 0x75, 0xde, 0x5b, 0x6a, 0xd, 0x37, 0x8f, 0xdb, 0xc, 0x38, 0x18, 0xb6, 0xab, 0x4f, 0xbf, 0x8e}, }, { - Name: "sqlite3.rc", Mode: 0644, + Name: "sqlite3.rc", Mode: filemode.Regular, Hash: plumbing.Hash{0x96, 0x98, 0x76, 0xda, 0x1e, 0x57, 0x14, 0x3d, 0xe0, 0xb4, 0xd1, 0xc7, 0x62, 0x9f, 0xd3, 0x35, 0x6f, 0x2e, 0x1c, 0x96}, }, { - Name: "sqlite3ext.h", Mode: 0644, + Name: "sqlite3ext.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x92, 0x8b, 0xb3, 0xba, 0xd9, 0xdd, 0x64, 0x3c, 0x30, 0x1d, 0xd2, 0xb0, 0xac, 0x22, 0x28, 0x7a, 0x81, 0x28, 0x48, 0x84}, }, { - Name: "sqliteInt.h", Mode: 0644, + Name: "sqliteInt.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x59, 0x50, 0xf2, 0x37, 0xd9, 0xf9, 0xf2, 0xd3, 0xef, 0x6b, 0xd8, 0xbe, 0x34, 0x2d, 0xcf, 0x64, 0x89, 0x22, 0x51, 0x42}, }, { - Name: "sqliteLimit.h", Mode: 0644, + Name: "sqliteLimit.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xc7, 0xae, 0xe5, 0x3c, 0xeb, 0xca, 0x94, 0xda, 0x51, 0xe7, 0x1a, 0x82, 0x2e, 0xa5, 0xa6, 0xde, 0xb9, 0x3, 0x85, 0xdf}, }, { - Name: "status.c", Mode: 0644, + Name: "status.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x28, 0x34, 0x9e, 0x6d, 0x3d, 0x20, 0x88, 0xe0, 0x0, 0x3b, 0x76, 0xf8, 0xa, 0x89, 0x54, 0xfa, 0xec, 0x59, 0x30, 0xba}, }, { - Name: "table.c", Mode: 0644, + Name: "table.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x26, 0xbb, 0xfb, 0x4f, 0x45, 0x6c, 0x42, 0x98, 0x25, 0x29, 0xea, 0x1a, 0x63, 0xa0, 0x17, 0x51, 0xdd, 0x3e, 0xe9, 0x5a}, }, { - Name: "tclsqlite.c", Mode: 0644, + Name: "tclsqlite.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xf1, 0xbb, 0x29, 0x21, 0xda, 0xc, 0x68, 0xa4, 0xf1, 0xc8, 0xe1, 0x5c, 0xf5, 0x66, 0xb2, 0x33, 0xe9, 0x2a, 0x51, 0x9f}, }, { - Name: "test1.c", Mode: 0644, + Name: "test1.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xa6, 0x38, 0xe4, 0x80, 0xad, 0xdf, 0x14, 0x43, 0x9c, 0xdf, 0xa4, 0xee, 0x16, 0x4d, 0xc3, 0x1b, 0x79, 0xf8, 0xbc, 0xac}, }, { - Name: "test2.c", Mode: 0644, + Name: "test2.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd1, 0x30, 0xe9, 0xd0, 0x1b, 0x70, 0x24, 0xa5, 0xec, 0x6d, 0x73, 0x5, 0x92, 0xee, 0x4d, 0x1f, 0xb0, 0x2c, 0xfd, 0xb4}, }, { - Name: "test3.c", Mode: 0644, + Name: "test3.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe3, 0xed, 0x31, 0xc, 0x81, 0x4, 0xfe, 0x36, 0x21, 0xce, 0xbb, 0xf, 0x51, 0xd1, 0x1, 0x45, 0x1, 0x8d, 0x4f, 0xac}, }, { - Name: "test4.c", Mode: 0644, + Name: "test4.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xa6, 0x37, 0x5c, 0x7c, 0xc4, 0x3, 0xf6, 0xc, 0xaa, 0xb7, 0xe9, 0x59, 0x53, 0x3e, 0x3d, 0xb1, 0xff, 0x75, 0xa, 0xe4}, }, { - Name: "test5.c", Mode: 0644, + Name: "test5.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x30, 0x3d, 0x12, 0x5, 0xb2, 0x26, 0x28, 0x42, 0x3d, 0x98, 0x6f, 0x71, 0xe2, 0x7c, 0x7c, 0xf7, 0x14, 0xa7, 0x45, 0xa6}, }, { - Name: "test6.c", Mode: 0644, + Name: "test6.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xc1, 0x51, 0xea, 0x42, 0x98, 0x9b, 0xb, 0xe2, 0x4e, 0xe4, 0xb9, 0xa4, 0xbe, 0x37, 0x8b, 0x4f, 0x63, 0x6d, 0xb6, 0x41}, }, { - Name: "test7.c", Mode: 0644, + Name: "test7.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x3c, 0xd4, 0xa2, 0x24, 0xd7, 0xe8, 0xe1, 0x6b, 0xd7, 0xcb, 0xe4, 0x9e, 0x2d, 0x3e, 0x94, 0xce, 0x9b, 0x17, 0xbd, 0x76}, }, { - Name: "test8.c", Mode: 0644, + Name: "test8.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xc5, 0x73, 0x93, 0x32, 0xd4, 0x6e, 0x57, 0x12, 0x1d, 0xa2, 0x7c, 0x3e, 0x88, 0xfd, 0xe7, 0x5a, 0xeb, 0x87, 0x10, 0xf7}, }, { - Name: "test9.c", Mode: 0644, + Name: "test9.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe5, 0x99, 0x3e, 0x8f, 0xf7, 0x8f, 0x61, 0xc2, 0x43, 0x5b, 0x6f, 0x97, 0xa3, 0xb4, 0x63, 0xe2, 0x27, 0xc7, 0x67, 0xac}, }, { - Name: "test_async.c", Mode: 0644, + Name: "test_async.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xb0, 0xb9, 0x43, 0x18, 0x5b, 0xfc, 0x23, 0xc1, 0x7f, 0xd0, 0x8f, 0x55, 0x76, 0x8c, 0xac, 0x12, 0xa9, 0xf5, 0x69, 0x51}, }, { - Name: "test_autoext.c", Mode: 0644, + Name: "test_autoext.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xb5, 0x1, 0x3f, 0x31, 0x73, 0xa2, 0x17, 0x6e, 0x2d, 0x9f, 0xc, 0xaa, 0x99, 0x19, 0x30, 0x36, 0xbf, 0xc3, 0x7e, 0x91}, }, { - Name: "test_backup.c", Mode: 0644, + Name: "test_backup.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe9, 0x67, 0x42, 0x4a, 0x29, 0xf, 0x73, 0x8a, 0xec, 0xfd, 0xac, 0x57, 0x8e, 0x9b, 0x87, 0xa4, 0xc4, 0xae, 0x8d, 0x7f}, }, { - Name: "test_btree.c", Mode: 0644, + Name: "test_btree.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xdb, 0x72, 0x88, 0x9b, 0x2a, 0xfb, 0x62, 0x72, 0x82, 0x8d, 0xda, 0x86, 0x6d, 0xcc, 0xf1, 0x22, 0xa4, 0x9a, 0x72, 0x99}, }, { - Name: "test_config.c", Mode: 0644, + Name: "test_config.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x53, 0x47, 0x27, 0xa0, 0x80, 0x42, 0xb6, 0xca, 0xd6, 0x7e, 0x26, 0x7e, 0x87, 0xb4, 0x3, 0xa4, 0x1a, 0x73, 0xb2, 0x99}, }, { - Name: "test_demovfs.c", Mode: 0644, + Name: "test_demovfs.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x63, 0x76, 0x27, 0x7, 0x1d, 0x9e, 0x28, 0xf4, 0xb3, 0x45, 0x1b, 0xbb, 0xdd, 0xf8, 0x8, 0xd1, 0xa9, 0x12, 0x0, 0xf8}, }, { - Name: "test_devsym.c", Mode: 0644, + Name: "test_devsym.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x21, 0xf0, 0xf6, 0x84, 0xd8, 0x61, 0x11, 0x67, 0x70, 0xde, 0xfc, 0xde, 0xcd, 0x53, 0x2b, 0xa3, 0xee, 0xab, 0xa9, 0x75}, }, { - Name: "test_fs.c", Mode: 0644, + Name: "test_fs.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x47, 0x8c, 0xad, 0x80, 0xb1, 0x6a, 0x90, 0x9b, 0x23, 0xbd, 0x3, 0xc2, 0xda, 0xd8, 0xb4, 0x49, 0xa7, 0x45, 0x87, 0xa1}, }, { - Name: "test_func.c", Mode: 0644, + Name: "test_func.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x6f, 0x9b, 0xb0, 0x3d, 0xc8, 0x8a, 0x21, 0xd6, 0x58, 0xbf, 0x99, 0x99, 0xba, 0xf6, 0x6d, 0xc1, 0xd5, 0x2e, 0xbc, 0x54}, }, { - Name: "test_hexio.c", Mode: 0644, + Name: "test_hexio.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xb2, 0xb, 0x5c, 0xe7, 0x30, 0xab, 0x7f, 0xa8, 0x0, 0xd2, 0xd0, 0xcc, 0x38, 0xc7, 0x72, 0x75, 0x59, 0x3e, 0xbd, 0xbb}, }, { - Name: "test_init.c", Mode: 0644, + Name: "test_init.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe3, 0x72, 0x4d, 0x8b, 0xe3, 0x14, 0xdb, 0x9, 0xee, 0xa8, 0x4, 0xb, 0x9d, 0xdf, 0xc8, 0xa8, 0xbe, 0xee, 0x22, 0x91}, }, { - Name: "test_intarray.c", Mode: 0644, + Name: "test_intarray.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xf5, 0xc3, 0xd9, 0xe4, 0x5, 0x9a, 0x16, 0x56, 0x7, 0x34, 0x7, 0xe4, 0x3a, 0x92, 0x11, 0x79, 0x99, 0x69, 0x7b, 0x93}, }, { - Name: "test_intarray.h", Mode: 0644, + Name: "test_intarray.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x69, 0x13, 0x37, 0xd1, 0xae, 0xd6, 0x37, 0x15, 0xd6, 0x2e, 0x76, 0x26, 0x6f, 0xf, 0x3b, 0x50, 0x8b, 0x1, 0xa, 0x34}, }, { - Name: "test_journal.c", Mode: 0644, + Name: "test_journal.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe8, 0x70, 0x1a, 0x4e, 0xea, 0xdb, 0x8e, 0xad, 0x16, 0x9d, 0x60, 0x6, 0x40, 0x7d, 0x54, 0xa8, 0x98, 0x59, 0x2d, 0x70}, }, { - Name: "test_loadext.c", Mode: 0644, + Name: "test_loadext.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x11, 0x37, 0xe3, 0xa9, 0xaa, 0xe9, 0x29, 0x6, 0xb8, 0x28, 0x9f, 0x6c, 0x3d, 0xaa, 0x61, 0xf0, 0xd0, 0x70, 0xf5, 0x5a}, }, { - Name: "test_malloc.c", Mode: 0644, + Name: "test_malloc.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xcf, 0x98, 0xa8, 0xfb, 0x21, 0x82, 0xc0, 0xba, 0xf5, 0xa, 0xd5, 0x79, 0x79, 0xb6, 0x75, 0xbb, 0x70, 0x7a, 0x93, 0xb0}, }, { - Name: "test_multiplex.c", Mode: 0644, + Name: "test_multiplex.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x62, 0x45, 0x41, 0xb3, 0x2a, 0x10, 0xd2, 0x1a, 0x2f, 0xd1, 0xa, 0x35, 0xee, 0x66, 0x32, 0xbd, 0xac, 0x55, 0x2d, 0x41}, }, { - Name: "test_multiplex.h", Mode: 0644, + Name: "test_multiplex.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xb7, 0xe1, 0xaf, 0xea, 0x5f, 0xd7, 0x8b, 0x87, 0x58, 0x2, 0x65, 0xf8, 0x4c, 0x81, 0x61, 0x2c, 0xbd, 0x2, 0x5b, 0xaf}, }, { - Name: "test_mutex.c", Mode: 0644, + Name: "test_mutex.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xc9, 0xb4, 0xa2, 0x9a, 0xb7, 0x5c, 0x77, 0xea, 0x5f, 0x36, 0xb5, 0x19, 0x32, 0x56, 0xd7, 0xf, 0xe6, 0x58, 0xe, 0x95}, }, { - Name: "test_onefile.c", Mode: 0644, + Name: "test_onefile.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x69, 0x86, 0x74, 0x41, 0xb8, 0xcc, 0x9a, 0x62, 0x1a, 0xf3, 0x24, 0x13, 0xfc, 0x63, 0xda, 0x80, 0x99, 0x37, 0x64, 0xf4}, }, { - Name: "test_osinst.c", Mode: 0644, + Name: "test_osinst.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x53, 0x14, 0x33, 0x31, 0x3e, 0xe3, 0x6c, 0x7, 0xeb, 0x21, 0xc0, 0x2f, 0x31, 0x15, 0xcb, 0x7a, 0x37, 0x48, 0x6c, 0x79}, }, { - Name: "test_pcache.c", Mode: 0644, + Name: "test_pcache.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x8f, 0xcf, 0xe7, 0xe2, 0x6e, 0x3f, 0xf1, 0x74, 0x96, 0xb8, 0x40, 0xf5, 0xd6, 0x3c, 0x75, 0x78, 0x3a, 0xff, 0x81, 0x62}, }, - {Name: "test_quota.c", Mode: 0644, Hash: plumbing.Hash{ - 0xe5, 0x90, 0x99, 0x6c, 0xa4, 0xb8, 0x57, 0x4a, 0xb1, 0xe4, 0x18, 0x5d, 0x57, 0x77, 0x56, 0x66, 0x4a, 0xd2, 0x49, 0x5f}}, {Name: "test_quota.h", Mode: 0644, + {Name: "test_quota.c", Mode: filemode.Regular, Hash: plumbing.Hash{ + 0xe5, 0x90, 0x99, 0x6c, 0xa4, 0xb8, 0x57, 0x4a, 0xb1, 0xe4, 0x18, 0x5d, 0x57, 0x77, 0x56, 0x66, 0x4a, 0xd2, 0x49, 0x5f}}, {Name: "test_quota.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x2d, 0x7, 0x67, 0xa1, 0x9a, 0xb7, 0xc3, 0xa4, 0x21, 0xcd, 0xba, 0x6a, 0x3, 0x49, 0x20, 0x43, 0x67, 0xc2, 0x2c, 0x81}, }, { - Name: "test_rtree.c", Mode: 0644, + Name: "test_rtree.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xf5, 0x4a, 0xe9, 0xb0, 0x63, 0xbb, 0x73, 0x71, 0x2f, 0xcf, 0xc1, 0xc6, 0x83, 0x2e, 0x2a, 0x50, 0xf6, 0x2a, 0x97, 0xe7}, }, { - Name: "test_schema.c", Mode: 0644, + Name: "test_schema.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x12, 0x64, 0x44, 0x67, 0x64, 0x7d, 0x51, 0x39, 0x4a, 0x1, 0xf9, 0xfa, 0x60, 0x37, 0x62, 0x98, 0x18, 0x54, 0x66, 0xfd}, }, { - Name: "test_server.c", Mode: 0644, + Name: "test_server.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xed, 0x8, 0x18, 0xe6, 0xf6, 0x5f, 0x27, 0x28, 0x2d, 0xc7, 0xb1, 0xc1, 0x90, 0xec, 0x18, 0x8c, 0x89, 0x33, 0x0, 0x2b}, }, { - Name: "test_sqllog.c", Mode: 0644, + Name: "test_sqllog.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x4a, 0xa6, 0x8b, 0x7c, 0x42, 0x93, 0x23, 0xb8, 0xee, 0xbe, 0x6c, 0x9c, 0x2d, 0x7, 0xfc, 0x66, 0xd, 0x8d, 0x47, 0xc9}, }, { - Name: "test_stat.c", Mode: 0644, + Name: "test_stat.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd4, 0xc9, 0x2, 0xb5, 0xea, 0x11, 0x1a, 0xd5, 0x8a, 0x73, 0x71, 0x12, 0xc2, 0x8f, 0x0, 0x38, 0x43, 0x4c, 0x85, 0xc0}, }, { - Name: "test_superlock.c", Mode: 0644, + Name: "test_superlock.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x93, 0x6f, 0xca, 0xd0, 0xc5, 0x6f, 0x6b, 0xc8, 0x58, 0x9, 0x74, 0x2f, 0x6a, 0xe1, 0xc1, 0xee, 0xb8, 0xb7, 0xd2, 0xf1}, }, { - Name: "test_syscall.c", Mode: 0644, + Name: "test_syscall.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x7c, 0x8, 0x73, 0xc1, 0x6d, 0x84, 0x32, 0x2, 0xf3, 0xe, 0x2d, 0xb9, 0x45, 0x9f, 0xa2, 0x99, 0x75, 0xea, 0x5e, 0x68}, }, { - Name: "test_tclvar.c", Mode: 0644, + Name: "test_tclvar.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x12, 0x19, 0x19, 0xc, 0x3, 0x0, 0xfd, 0x5e, 0xc7, 0xa3, 0xc5, 0x84, 0x8, 0xf3, 0x38, 0x43, 0xd2, 0xe, 0xee, 0x15}, }, { - Name: "test_thread.c", Mode: 0644, + Name: "test_thread.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x2f, 0x93, 0x63, 0xb7, 0x50, 0x1e, 0x51, 0x19, 0x81, 0xfe, 0x32, 0x83, 0x1f, 0xf2, 0xe8, 0xfd, 0x2f, 0x30, 0xc4, 0x93}, }, { - Name: "test_vfs.c", Mode: 0644, + Name: "test_vfs.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xfc, 0xd5, 0x77, 0x43, 0x9c, 0xfd, 0x6c, 0x72, 0xdd, 0xe4, 0x83, 0x58, 0x92, 0x14, 0x20, 0xcf, 0x6e, 0xf1, 0xf8, 0x6d}, }, { - Name: "test_vfstrace.c", Mode: 0644, + Name: "test_vfstrace.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xa, 0xac, 0xc0, 0x1f, 0xe4, 0x2e, 0x77, 0xfe, 0xb8, 0x58, 0xe4, 0xbe, 0xd0, 0xcb, 0x7e, 0x4, 0xa4, 0x35, 0xb2, 0x10}, }, { - Name: "test_wsd.c", Mode: 0644, + Name: "test_wsd.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x99, 0xe4, 0xa0, 0x56, 0x58, 0x1f, 0x58, 0xf4, 0x53, 0x6f, 0xdb, 0x5a, 0x5d, 0xf7, 0x5c, 0x74, 0x69, 0x8a, 0x81, 0x62}, }, { - Name: "tokenize.c", Mode: 0644, + Name: "tokenize.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xfa, 0xea, 0x5f, 0x26, 0xc7, 0x9c, 0x5e, 0x18, 0x8f, 0xa8, 0x7f, 0x2f, 0xdf, 0x6f, 0xf7, 0x6a, 0x7a, 0x60, 0x6, 0xc5}, }, { - Name: "trigger.c", Mode: 0644, + Name: "trigger.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xf1, 0xff, 0x76, 0x6e, 0x20, 0x2a, 0x45, 0x18, 0xec, 0x10, 0xe5, 0x27, 0x12, 0xc, 0xd3, 0xe, 0x83, 0xfb, 0xd0, 0x34}, }, { - Name: "update.c", Mode: 0644, + Name: "update.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x3a, 0xb1, 0xab, 0x2a, 0x4b, 0x65, 0xda, 0x3f, 0x19, 0x8c, 0x15, 0x84, 0xd5, 0x4d, 0x36, 0xf1, 0x8c, 0xa1, 0x21, 0x4a}, }, { - Name: "utf.c", Mode: 0644, + Name: "utf.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x6d, 0x5b, 0x1b, 0xfe, 0x40, 0xc, 0x37, 0x48, 0xaa, 0x70, 0xa3, 0xb2, 0xfd, 0x5e, 0xe, 0xac, 0x5f, 0xc0, 0x4d, 0xe2}, }, { - Name: "util.c", Mode: 0644, + Name: "util.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xd8, 0x3a, 0x63, 0x1, 0x5f, 0xd8, 0x7d, 0xcc, 0x4f, 0xb4, 0x41, 0x66, 0xfa, 0xbf, 0x2e, 0x9b, 0xc9, 0x67, 0x1e, 0xb8}, }, { - Name: "vacuum.c", Mode: 0644, + Name: "vacuum.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x4a, 0xfb, 0x2c, 0xca, 0x64, 0xdd, 0x60, 0x76, 0x11, 0x22, 0x2c, 0x7, 0x93, 0x2d, 0x12, 0xea, 0xcf, 0xa, 0x2c, 0x22}, }, { - Name: "vdbe.c", Mode: 0644, + Name: "vdbe.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xf3, 0x43, 0xe1, 0x3d, 0x4e, 0x91, 0x78, 0x4b, 0x15, 0x88, 0x10, 0xc5, 0xb7, 0xd4, 0x46, 0x84, 0xdf, 0xbf, 0xa2, 0xa5}, }, { - Name: "vdbe.h", Mode: 0644, + Name: "vdbe.h", Mode: filemode.Regular, Hash: plumbing.Hash{0xfa, 0x7b, 0x31, 0xb7, 0x27, 0xa, 0x90, 0xd4, 0xf6, 0x37, 0x36, 0x5a, 0xfc, 0xc9, 0xbd, 0xa1, 0xd1, 0xb1, 0xe1, 0xd6}, }, { - Name: "vdbeInt.h", Mode: 0644, + Name: "vdbeInt.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x3a, 0x5b, 0x40, 0x28, 0xbb, 0xd6, 0xc9, 0x56, 0x10, 0xd7, 0xc, 0xce, 0x3, 0x69, 0xdf, 0xcd, 0x60, 0x7a, 0xa9, 0x0}, }, { - Name: "vdbeapi.c", Mode: 0644, + Name: "vdbeapi.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x7c, 0x86, 0x1e, 0x2d, 0x47, 0x21, 0x8c, 0x91, 0x63, 0x31, 0x77, 0x77, 0xc3, 0x7, 0x21, 0x99, 0xe9, 0xb4, 0x2, 0x80}, }, { - Name: "vdbeaux.c", Mode: 0644, + Name: "vdbeaux.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x2c, 0x42, 0x69, 0xa5, 0x9e, 0x6d, 0xbc, 0xe8, 0x67, 0x1c, 0x47, 0x4f, 0x34, 0x61, 0x90, 0xbe, 0x2a, 0xe, 0x18, 0x51}, }, { - Name: "vdbeblob.c", Mode: 0644, + Name: "vdbeblob.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x2e, 0x8f, 0xd8, 0xee, 0x74, 0x47, 0xe6, 0x46, 0x46, 0xe3, 0x49, 0x4b, 0x4c, 0x4, 0x1d, 0x3a, 0x4a, 0xbb, 0x8, 0x85}, }, { - Name: "vdbemem.c", Mode: 0644, + Name: "vdbemem.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x8f, 0xc2, 0x22, 0xe2, 0xde, 0x20, 0x50, 0x14, 0x50, 0xec, 0xea, 0x9d, 0x4e, 0xbf, 0xaa, 0xc9, 0x81, 0x4a, 0xae, 0x59}, }, { - Name: "vdbesort.c", Mode: 0644, + Name: "vdbesort.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xfd, 0xfc, 0x4a, 0x79, 0xdd, 0xc9, 0x6e, 0x59, 0x9b, 0x1b, 0xe, 0xeb, 0xac, 0xbd, 0xb8, 0x45, 0xc6, 0x38, 0x13, 0xb2}, }, { - Name: "vdbetrace.c", Mode: 0644, + Name: "vdbetrace.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x35, 0x62, 0x77, 0xe8, 0xd2, 0x3b, 0xca, 0xdb, 0x67, 0x6b, 0x59, 0xd1, 0xa4, 0xdc, 0xf8, 0x42, 0xfd, 0xc4, 0xc9, 0x72}, }, { - Name: "vtab.c", Mode: 0644, + Name: "vtab.c", Mode: filemode.Regular, Hash: plumbing.Hash{0x95, 0x82, 0x2, 0xc3, 0x1e, 0x24, 0x15, 0xb, 0x60, 0xf1, 0xa, 0x8a, 0xf, 0x74, 0x41, 0xaf, 0xac, 0x3f, 0xbb, 0x1c}, }, { - Name: "wal.c", Mode: 0644, + Name: "wal.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe6, 0x42, 0xea, 0x21, 0x5, 0xb5, 0xc5, 0x4a, 0xf3, 0x5, 0x88, 0x9, 0x62, 0x69, 0xab, 0x75, 0xcb, 0xef, 0x8f, 0xf2}, }, { - Name: "wal.h", Mode: 0644, + Name: "wal.h", Mode: filemode.Regular, Hash: plumbing.Hash{0x9, 0x25, 0x46, 0x35, 0x4b, 0x34, 0xc0, 0xab, 0x3d, 0x20, 0x5, 0x6a, 0x7f, 0x8a, 0x8a, 0x52, 0xe4, 0xd0, 0xb5, 0xf5}, }, { - Name: "walker.c", Mode: 0644, + Name: "walker.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe7, 0x1e, 0xd2, 0xac, 0x48, 0x4c, 0x91, 0x6c, 0x1c, 0xc1, 0x0, 0x7e, 0x5e, 0x5, 0xda, 0x47, 0x1c, 0xb4, 0x95, 0x99}, }, { - Name: "where.c", Mode: 0644, + Name: "where.c", Mode: filemode.Regular, Hash: plumbing.Hash{0xe6, 0x14, 0xf4, 0xa6, 0xd8, 0x64, 0xe7, 0xe, 0xc4, 0x32, 0x8d, 0xb, 0xdb, 0x25, 0x4e, 0x3a, 0xc9, 0xf0, 0xd2, 0x87}, }, }, diff --git a/plumbing/object/treenoder.go b/plumbing/object/treenoder.go index 73d96e2..89fcdb1 100644 --- a/plumbing/object/treenoder.go +++ b/plumbing/object/treenoder.go @@ -9,18 +9,17 @@ package object // to the file contents by the merkletrie difftree algorithm. This is // consistent with how the "git diff-tree" command works. import ( - "encoding/binary" "io" - "os" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/utils/merkletrie/noder" ) type treeNoder struct { parent *Tree // the root node is its own parent name string // empty string for the root node - mode os.FileMode + mode filemode.FileMode hash plumbing.Hash children []noder.Noder // memoized } @@ -33,7 +32,7 @@ func newTreeNoder(t *Tree) *treeNoder { return &treeNoder{ parent: t, name: "", - mode: os.ModeDir, + mode: filemode.Dir, hash: t.Hash, } } @@ -47,14 +46,7 @@ func (t *treeNoder) String() string { } func (t *treeNoder) Hash() []byte { - return append(t.hash[:], modeToBytes(t.mode)...) -} - -// mode in little endian (endianess is an arbitrary decission). -func modeToBytes(m os.FileMode) []byte { - ret := make([]byte, 4) - binary.LittleEndian.PutUint32(ret, uint32(m)) - return ret + return append(t.hash[:], t.mode.Bytes()...) } func (t *treeNoder) Name() string { @@ -62,13 +54,13 @@ func (t *treeNoder) Name() string { } func (t *treeNoder) IsDir() bool { - return t.mode.IsDir() + return t.mode == filemode.Dir } // Children will return the children of a treenoder as treenoders, // building them from the children of the wrapped git tree. func (t *treeNoder) Children() ([]noder.Noder, error) { - if !t.mode.IsDir() { + if t.mode != filemode.Dir { return noder.NoChildren, nil } diff --git a/worktree.go b/worktree.go index 2a4e5d8..36b17b6 100644 --- a/worktree.go +++ b/worktree.go @@ -9,6 +9,7 @@ import ( "srcd.works/go-git.v4/config" "srcd.works/go-git.v4/plumbing" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/format/index" "srcd.works/go-git.v4/plumbing/object" @@ -65,11 +66,11 @@ func (w *Worktree) Checkout(commit plumbing.Hash) error { } func (w *Worktree) checkoutEntry(name string, e *object.TreeEntry, idx *index.Index) error { - if e.Mode == object.SubmoduleMode { + if e.Mode == filemode.Submodule { return w.addIndexFromTreeEntry(name, e, idx) } - if e.Mode.IsDir() { + if e.Mode == filemode.Dir { return nil } @@ -86,18 +87,23 @@ func (w *Worktree) checkoutFile(name string, e *object.TreeEntry, idx *index.Ind if err != nil { return err } - defer from.Close() - to, err := w.fs.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, e.Mode.Perm()) + + mode, err := e.Mode.ToOSFileMode() + if err != nil { + return err + } + + to, err := w.fs.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, mode.Perm()) if err != nil { return err } + defer to.Close() if _, err := io.Copy(to, from); err != nil { return err } - defer to.Close() return w.addIndexFromFile(name, e, idx) } @@ -107,7 +113,7 @@ func (w *Worktree) addIndexFromTreeEntry(name string, f *object.TreeEntry, idx * idx.Entries = append(idx.Entries, index.Entry{ Hash: f.Hash, Name: name, - Mode: object.SubmoduleMode, + Mode: filemode.Submodule, }) return nil @@ -119,10 +125,15 @@ func (w *Worktree) addIndexFromFile(name string, f *object.TreeEntry, idx *index return err } + mode, err := filemode.NewFromOSFileMode(fi.Mode()) + if err != nil { + return err + } + e := index.Entry{ Hash: f.Hash, Name: name, - Mode: w.getMode(fi), + Mode: mode, ModifiedAt: fi.ModTime(), Size: uint32(fi.Size()), } @@ -178,7 +189,12 @@ func (w *Worktree) compareFileWithEntry(fi billy.FileInfo, e *index.Entry) (Stat return Modified, nil } - if w.getMode(fi) != e.Mode { + mode, err := filemode.NewFromOSFileMode(fi.Mode()) + if err != nil { + return Modified, err + } + + if mode != e.Mode { return Modified, nil } @@ -191,23 +207,6 @@ func (w *Worktree) compareFileWithEntry(fi billy.FileInfo, e *index.Entry) (Stat return Unmodified, nil } -func (w *Worktree) getMode(fi billy.FileInfo) os.FileMode { - if fi.Mode().IsDir() { - return object.TreeMode - } - - if fi.Mode()&os.ModeSymlink != 0 { - return object.SymlinkMode - } - - const modeExec = 0111 - if fi.Mode()&modeExec != 0 { - return object.ExecutableMode - } - - return object.FileMode -} - const gitmodulesFile = ".gitmodules" // Submodule returns the submodule with the given name diff --git a/worktree_test.go b/worktree_test.go index 81d35b1..afc592e 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -4,8 +4,8 @@ import ( "io/ioutil" "os" + "srcd.works/go-git.v4/plumbing/filemode" "srcd.works/go-git.v4/plumbing/format/index" - "srcd.works/go-git.v4/plumbing/object" "github.com/src-d/go-git-fixtures" . "gopkg.in/check.v1" @@ -72,7 +72,7 @@ func (s *WorktreeSuite) TestCheckoutIndexmemfs(c *C) { c.Assert(idx.Entries, HasLen, 9) c.Assert(idx.Entries[0].Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88") c.Assert(idx.Entries[0].Name, Equals, ".gitignore") - c.Assert(idx.Entries[0].Mode, Equals, object.FileMode) + c.Assert(idx.Entries[0].Mode, Equals, filemode.Regular) c.Assert(idx.Entries[0].ModifiedAt.IsZero(), Equals, false) c.Assert(idx.Entries[0].Size, Equals, uint32(189)) @@ -105,7 +105,7 @@ func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) { c.Assert(idx.Entries, HasLen, 9) c.Assert(idx.Entries[0].Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88") c.Assert(idx.Entries[0].Name, Equals, ".gitignore") - c.Assert(idx.Entries[0].Mode, Equals, object.FileMode) + c.Assert(idx.Entries[0].Mode, Equals, filemode.Regular) c.Assert(idx.Entries[0].ModifiedAt.IsZero(), Equals, false) c.Assert(idx.Entries[0].Size, Equals, uint32(189)) |