diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-30 16:24:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 16:24:07 +0100 |
commit | a24e40af0aa2d9d512051269993a1b08c0496d12 (patch) | |
tree | 65936a6a365263c93e4b57c3b67aad6a13489e68 /plumbing/object/tree.go | |
parent | a48bc6e17ef6298f93ec21cdf1a5e387640673b6 (diff) | |
parent | 35378e7db9288e8244f2634a1b47981606731cef (diff) | |
download | go-git-a24e40af0aa2d9d512051269993a1b08c0496d12.tar.gz |
Merge pull request #229 from mcuadros/worktree
Worktree and new Repository Contructors
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r-- | plumbing/object/tree.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go index f3e03bc..e197310 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 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. @@ -239,10 +243,14 @@ func (t *Tree) decodeFileMode(mode string) (os.FileMode, error) { } m := os.FileMode(fm) - switch fm { - case 0040000: //tree + switch os.FileMode(fm) { + case FileMode: + m = 0644 + case ExecutableMode: + m = 0755 + case TreeMode: m = m | os.ModeDir - case 0120000: //symlink + case SymlinkMode: m = m | os.ModeSymlink } @@ -367,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 } |