Skip to content

Commit a48dcc6

Browse files
committed
remove duplicate commit lookup
its already resolved and stored in ctx.Repo.Commit!
1 parent b3c334e commit a48dcc6

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

routers/web/repo/blame.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,6 @@ func RefBlame(ctx *context.Context) {
5151
repoName := ctx.Repo.Repository.Name
5252
commitID := ctx.Repo.CommitID
5353

54-
commit, err := ctx.Repo.GitRepo.GetCommit(commitID)
55-
if err != nil {
56-
if git.IsErrNotExist(err) {
57-
ctx.NotFound("Repo.GitRepo.GetCommit", err)
58-
} else {
59-
ctx.ServerError("Repo.GitRepo.GetCommit", err)
60-
}
61-
return
62-
}
63-
if len(commitID) != 40 {
64-
commitID = commit.ID.String()
65-
}
66-
6754
branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
6855
treeLink := branchLink
6956
rawLink := ctx.Repo.RepoLink + "/raw/" + ctx.Repo.BranchNameSubURL()
@@ -148,7 +135,7 @@ func RefBlame(ctx *context.Context) {
148135
previousCommits := make(map[string]string)
149136
commits := list.New()
150137
commitCache := map[string]*git.Commit{}
151-
commitCache[commitID] = commit
138+
commitCache[ctx.Repo.Commit.ID.String()] = ctx.Repo.Commit
152139

153140
for _, part := range blameParts {
154141
sha := part.Sha

0 commit comments

Comments
 (0)