|
@@ -16,6 +16,7 @@ type RepoFile struct {
|
|
Path string
|
|
Path string
|
|
Message string
|
|
Message string
|
|
Created time.Time
|
|
Created time.Time
|
|
|
|
+ Size int64
|
|
}
|
|
}
|
|
|
|
|
|
func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile, error) {
|
|
func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile, error) {
|
|
@@ -40,6 +41,10 @@ func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile,
|
|
var repofiles []*RepoFile
|
|
var repofiles []*RepoFile
|
|
lastCommit.Tree.Walk(func(dirname string, entry *git.TreeEntry) int {
|
|
lastCommit.Tree.Walk(func(dirname string, entry *git.TreeEntry) int {
|
|
if dirname == rpath {
|
|
if dirname == rpath {
|
|
|
|
+ size, err := repo.ObjectSize(entry.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
switch entry.Filemode {
|
|
switch entry.Filemode {
|
|
case git.FileModeBlob, git.FileModeBlobExec:
|
|
case git.FileModeBlob, git.FileModeBlobExec:
|
|
repofiles = append(repofiles, &RepoFile{
|
|
repofiles = append(repofiles, &RepoFile{
|
|
@@ -47,6 +52,7 @@ func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile,
|
|
path.Join(dirname, entry.Name),
|
|
path.Join(dirname, entry.Name),
|
|
lastCommit.Message(),
|
|
lastCommit.Message(),
|
|
lastCommit.Committer.When,
|
|
lastCommit.Committer.When,
|
|
|
|
+ size,
|
|
})
|
|
})
|
|
case git.FileModeTree:
|
|
case git.FileModeTree:
|
|
repodirs = append(repodirs, &RepoFile{
|
|
repodirs = append(repodirs, &RepoFile{
|
|
@@ -54,6 +60,7 @@ func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile,
|
|
path.Join(dirname, entry.Name),
|
|
path.Join(dirname, entry.Name),
|
|
lastCommit.Message(),
|
|
lastCommit.Message(),
|
|
lastCommit.Committer.When,
|
|
lastCommit.Committer.When,
|
|
|
|
+ size,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|