@@ -215,13 +215,12 @@ func SearchCommits(ctx *context.Context) {
215215
216216// FileHistory show a file's reversions
217217func FileHistory (ctx * context.Context ) {
218- fileName := ctx .Repo .TreePath
219- if len (fileName ) == 0 {
218+ if ctx .Repo .TreePath == "" {
220219 Commits (ctx )
221220 return
222221 }
223222
224- commitsCount , err := ctx .Repo .GitRepo .FileCommitsCount (ctx .Repo .RefFullName .ShortName (), fileName ) // FIXME: legacy code used ShortName
223+ commitsCount , err := ctx .Repo .GitRepo .FileCommitsCount (ctx .Repo .RefFullName .ShortName (), ctx . Repo . TreePath )
225224 if err != nil {
226225 ctx .ServerError ("FileCommitsCount" , err )
227226 return
@@ -238,7 +237,7 @@ func FileHistory(ctx *context.Context) {
238237 commits , err := ctx .Repo .GitRepo .CommitsByFileAndRange (
239238 git.CommitsByFileAndRangeOptions {
240239 Revision : ctx .Repo .RefFullName .ShortName (), // FIXME: legacy code used ShortName
241- File : fileName ,
240+ File : ctx . Repo . TreePath ,
242241 Page : page ,
243242 })
244243 if err != nil {
@@ -253,7 +252,7 @@ func FileHistory(ctx *context.Context) {
253252
254253 ctx .Data ["Username" ] = ctx .Repo .Owner .Name
255254 ctx .Data ["Reponame" ] = ctx .Repo .Repository .Name
256- ctx .Data ["FileName " ] = fileName
255+ ctx .Data ["FileTreePath " ] = ctx . Repo . TreePath
257256 ctx .Data ["CommitCount" ] = commitsCount
258257
259258 pager := context .NewPagination (int (commitsCount ), setting .Git .CommitsRangeSize , page , 5 )
0 commit comments