@@ -215,13 +215,12 @@ func SearchCommits(ctx *context.Context) {
215
215
216
216
// FileHistory show a file's reversions
217
217
func FileHistory (ctx * context.Context ) {
218
- fileName := ctx .Repo .TreePath
219
- if len (fileName ) == 0 {
218
+ if ctx .Repo .TreePath == "" {
220
219
Commits (ctx )
221
220
return
222
221
}
223
222
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 )
225
224
if err != nil {
226
225
ctx .ServerError ("FileCommitsCount" , err )
227
226
return
@@ -238,7 +237,7 @@ func FileHistory(ctx *context.Context) {
238
237
commits , err := ctx .Repo .GitRepo .CommitsByFileAndRange (
239
238
git.CommitsByFileAndRangeOptions {
240
239
Revision : ctx .Repo .RefFullName .ShortName (), // FIXME: legacy code used ShortName
241
- File : fileName ,
240
+ File : ctx . Repo . TreePath ,
242
241
Page : page ,
243
242
})
244
243
if err != nil {
@@ -253,7 +252,7 @@ func FileHistory(ctx *context.Context) {
253
252
254
253
ctx .Data ["Username" ] = ctx .Repo .Owner .Name
255
254
ctx .Data ["Reponame" ] = ctx .Repo .Repository .Name
256
- ctx .Data ["FileName " ] = fileName
255
+ ctx .Data ["FileTreePath " ] = ctx . Repo . TreePath
257
256
ctx .Data ["CommitCount" ] = commitsCount
258
257
259
258
pager := context .NewPagination (int (commitsCount ), setting .Git .CommitsRangeSize , page , 5 )
0 commit comments