aboutsummaryrefslogtreecommitdiffstats
path: root/file.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-04-22 11:35:12 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-04-22 11:35:12 +0200
commitb08327bfaf27171dddc5516c63e5646c40f0b004 (patch)
treed974021a3d804b055a807363f3ba71d9b6d54825 /file.go
parentb35fc295b4ac531adc72fc83f2af628c7c163c0e (diff)
downloadgo-git-b08327bfaf27171dddc5516c63e5646c40f0b004.tar.gz
file, added field Modev3.0.1
Diffstat (limited to 'file.go')
-rw-r--r--file.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/file.go b/file.go
index 76ec962..35bbdc5 100644
--- a/file.go
+++ b/file.go
@@ -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
}
}
}