From cf9efc629eae67dc5c05c06e3cb0470bb1696f73 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sat, 28 Jan 2017 21:38:29 +0100 Subject: object: modes in TreeEntry as os.FileMode, and not the git internal --- plumbing/object/tree.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plumbing/object/tree.go') diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go index f3e03bc..b7681f3 100644 --- a/plumbing/object/tree.go +++ b/plumbing/object/tree.go @@ -18,8 +18,12 @@ import ( const ( maxTreeDepth = 1024 startingStackSize = 8 - submoduleMode = 0160000 - directoryMode = 0040000 + + fileMode = 0100644 + executableMode = 0100755 + submoduleMode = 0160000 + symlinkMode = 0120000 + treeMode = 0040000 ) // New errors defined by this package. @@ -240,9 +244,13 @@ func (t *Tree) decodeFileMode(mode string) (os.FileMode, error) { m := os.FileMode(fm) switch fm { - case 0040000: //tree + case fileMode: + m = 0644 + case executableMode: + m = 0755 + case treeMode: m = m | os.ModeDir - case 0120000: //symlink + case symlinkMode: m = m | os.ModeSymlink } -- cgit From 677a596cdb534f485ff8d9488e05855387a6ef00 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Mon, 30 Jan 2017 11:27:42 +0100 Subject: Worktree correct FileMode at index entries --- plumbing/object/tree.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'plumbing/object/tree.go') diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go index b7681f3..e197310 100644 --- a/plumbing/object/tree.go +++ b/plumbing/object/tree.go @@ -19,11 +19,11 @@ const ( maxTreeDepth = 1024 startingStackSize = 8 - fileMode = 0100644 - executableMode = 0100755 - submoduleMode = 0160000 - symlinkMode = 0120000 - treeMode = 0040000 + FileMode os.FileMode = 0100644 + ExecutableMode os.FileMode = 0100755 + SubmoduleMode os.FileMode = 0160000 + SymlinkMode os.FileMode = 0120000 + TreeMode os.FileMode = 0040000 ) // New errors defined by this package. @@ -243,14 +243,14 @@ func (t *Tree) decodeFileMode(mode string) (os.FileMode, error) { } m := os.FileMode(fm) - switch fm { - case fileMode: + switch os.FileMode(fm) { + case FileMode: m = 0644 - case executableMode: + case ExecutableMode: m = 0755 - case treeMode: + case TreeMode: m = m | os.ModeDir - case symlinkMode: + case SymlinkMode: m = m | os.ModeSymlink } @@ -375,7 +375,7 @@ func (w *TreeWalker) Next() (name string, entry TreeEntry, err error) { return } - if entry.Mode == submoduleMode { + if entry.Mode == SubmoduleMode { err = nil continue } -- cgit