diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-04-22 11:35:12 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-04-22 11:35:12 +0200 |
commit | b08327bfaf27171dddc5516c63e5646c40f0b004 (patch) | |
tree | d974021a3d804b055a807363f3ba71d9b6d54825 /file.go | |
parent | b35fc295b4ac531adc72fc83f2af628c7c163c0e (diff) | |
download | go-git-b08327bfaf27171dddc5516c63e5646c40f0b004.tar.gz |
file, added field Modev3.0.1
Diffstat (limited to 'file.go')
-rw-r--r-- | file.go | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -2,17 +2,19 @@ package git import ( "bytes" + "os" "strings" ) // File represents git file objects. type File struct { Name string + Mode os.FileMode Blob } -func newFile(name string, b *Blob) *File { - return &File{Name: name, Blob: *b} +func newFile(name string, m os.FileMode, b *Blob) *File { + return &File{Name: name, Mode: m, Blob: *b} } // Contents returns the contents of a file as a string. @@ -57,13 +59,13 @@ func NewFileIter(r *Repository, t *Tree) *FileIter { func (iter *FileIter) Next() (*File, error) { for { - name, _, obj, err := iter.w.Next() + name, entry, obj, err := iter.w.Next() if err != nil { return nil, err } if blob, ok := obj.(*Blob); ok { - return newFile(name, blob), nil + return newFile(name, entry.Mode, blob), nil } } } |