| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package git |
| 6 |
| 7 import ( |
| 8 "fmt" |
| 9 ) |
| 10 |
| 11 // Types /////////////////////////////////////////////////////////////////////// |
| 12 |
| 13 // Mode is a typed representation of git's tree mode concept |
| 14 type Mode int |
| 15 |
| 16 // Member functions //////////////////////////////////////////////////////////// |
| 17 |
| 18 // Type returns a Object.Type() compatible string for this mode. |
| 19 func (m Mode) Type() ObjectType { |
| 20 switch { |
| 21 case m == 0040000: |
| 22 return TreeType |
| 23 case m == 0160000: |
| 24 return CommitType |
| 25 case (m & 0100000) != 0: |
| 26 return BlobType |
| 27 default: |
| 28 return UnknownType |
| 29 } |
| 30 } |
| 31 |
| 32 func (m Mode) String() string { return fmt.Sprintf("%06o", m) } |
| OLD | NEW |