|
|
@ -8,12 +8,11 @@ import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/Unknwon/paginater" |
|
|
|
"github.com/Unknwon/paginater" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gogits/git-shell" |
|
|
|
git "github.com/gogits/git-shell" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
"github.com/gogits/gogs/modules/base" |
|
|
|
"github.com/gogits/gogs/modules/base" |
|
|
@ -134,38 +133,13 @@ func Home(ctx *middleware.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
entries.Sort() |
|
|
|
entries.Sort() |
|
|
|
|
|
|
|
|
|
|
|
files := make([][]interface{}, 0, len(entries)) |
|
|
|
ctx.Data["Files"], err = entries.GetCommitsInfo(ctx.Repo.Commit, treePath) |
|
|
|
for _, te := range entries { |
|
|
|
|
|
|
|
if te.Type != git.OBJECT_COMMIT { |
|
|
|
|
|
|
|
c, err := ctx.Repo.Commit.GetCommitByPath(filepath.Join(treePath, te.Name())) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
ctx.Handle(500, "GetCommitByPath", err) |
|
|
|
ctx.Handle(500, "GetCommitsInfo", err) |
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
files = append(files, []interface{}{te, c}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
sm, err := ctx.Repo.Commit.GetSubModule(path.Join(treename, te.Name())) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
ctx.Handle(500, "GetSubModule", err) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
smUrl := "" |
|
|
|
|
|
|
|
if sm != nil { |
|
|
|
|
|
|
|
smUrl = sm.Url |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c, err := ctx.Repo.Commit.GetCommitByPath(filepath.Join(treePath, te.Name())) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
ctx.Handle(500, "GetCommitByPath", err) |
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
files = append(files, []interface{}{te, git.NewSubModuleFile(c, smUrl, te.ID.String())}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ctx.Data["Files"] = files |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var readmeFile *git.Blob |
|
|
|
var readmeFile *git.Blob |
|
|
|
|
|
|
|
|
|
|
|
for _, f := range entries { |
|
|
|
for _, f := range entries { |
|
|
|
if f.IsDir() || !base.IsReadmeFile(f.Name()) { |
|
|
|
if f.IsDir() || !base.IsReadmeFile(f.Name()) { |
|
|
|
continue |
|
|
|
continue |
|
|
|