@ -215,13 +215,12 @@ func SearchCommits(ctx *context.Context) {
// FileHistory show a file's reversions
func FileHistory ( ctx * context . Context ) {
fileName := ctx . Repo . TreePath
if len ( fileName ) == 0 {
if ctx . Repo . TreePath == "" {
Commits ( ctx )
return
}
commitsCount , err := ctx . Repo . GitRepo . FileCommitsCount ( ctx . Repo . RefFullName . ShortName ( ) , fileName) // FIXME: legacy code used ShortName
commitsCount , err := ctx . Repo . GitRepo . FileCommitsCount ( ctx . Repo . RefFullName . ShortName ( ) , ctx. Repo . TreePath )
if err != nil {
ctx . ServerError ( "FileCommitsCount" , err )
return
@ -238,7 +237,7 @@ func FileHistory(ctx *context.Context) {
commits , err := ctx . Repo . GitRepo . CommitsByFileAndRange (
git . CommitsByFileAndRangeOptions {
Revision : ctx . Repo . RefFullName . ShortName ( ) , // FIXME: legacy code used ShortName
File : fileName ,
File : ctx. Repo . TreePath ,
Page : page ,
} )
if err != nil {
@ -253,7 +252,7 @@ func FileHistory(ctx *context.Context) {
ctx . Data [ "Username" ] = ctx . Repo . Owner . Name
ctx . Data [ "Reponame" ] = ctx . Repo . Repository . Name
ctx . Data [ "File Name"] = fileName
ctx . Data [ "File TreePath"] = ctx . Repo . TreePath
ctx . Data [ "CommitCount" ] = commitsCount
pager := context . NewPagination ( int ( commitsCount ) , setting . Git . CommitsRangeSize , page , 5 )