aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-15 10:29:22 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-15 10:29:22 -0400
commitc44f18cae13b9833636624c3ac9e5c5d12cf526f (patch)
tree9ba9319ec79ccbd9d89d85be0d7817a5fc75828c /models
parentb3373aa8d3c7bf0e7aac61fca4a6130d3f12e027 (diff)
parentca86433402463fb423b75d1527407c5203aba5ce (diff)
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'models')
-rw-r--r--models/repo2.go33
1 files changed, 23 insertions, 10 deletions
diff --git a/models/repo2.go b/models/repo2.go
index 6aa6eda6..beeb8021 100644
--- a/models/repo2.go
+++ b/models/repo2.go
@@ -8,7 +8,7 @@ import (
"path"
"time"
- git "github.com/speedata/gogit"
+ git "github.com/gogits/git"
)
type RepoFile struct {
@@ -46,20 +46,33 @@ func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile,
return nil, err
}
+ var repodirs []*RepoFile
var repofiles []*RepoFile
lastCommit.Tree.Walk(func(dirname string, entry *git.TreeEntry) int {
if dirname == rpath {
- repofiles = append(repofiles, &RepoFile{
- entry.Id,
- entry.Filemode,
- entry.Name,
- path.Join(dirname, entry.Name),
- lastCommit.Message(),
- lastCommit.Committer.When,
- })
+ switch entry.Filemode {
+ case git.FileModeBlob, git.FileModeBlobExec:
+ repofiles = append(repofiles, &RepoFile{
+ entry.Id,
+ entry.Filemode,
+ entry.Name,
+ path.Join(dirname, entry.Name),
+ lastCommit.Message(),
+ lastCommit.Committer.When,
+ })
+ case git.FileModeTree:
+ repodirs = append(repodirs, &RepoFile{
+ entry.Id,
+ entry.Filemode,
+ entry.Name,
+ path.Join(dirname, entry.Name),
+ lastCommit.Message(),
+ lastCommit.Committer.When,
+ })
+ }
}
return 0
})
- return repofiles, nil
+ return append(repodirs, repofiles...), nil
}