loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use information from previous blame parts (#28572)

Fixes #28545

`git blame` output can contain blocks without commit information if it
was outputted before (the `0dafa97ea3f6d9662299579e5be1875cd28baaae 48
26 1` line):
```
fec25436488499df7231f63b857f66457c193d5c 24 25 1
author Bastien Montagne
author-mail <bastien@blender.org>
author-time 1660731031
author-tz +0200
committer Bastien Montagne
committer-mail <bastien@blender.org>
committer-time 1660731031
committer-tz +0200
summary LibOverride: Add Make/Reset/Clear entries to IDTemplate contextual menu.
previous 839ece6477203382b7a7483062961540180ff1cd source/blender/editors/interface/interface_ops.c
filename source/blender/editors/interface/interface_ops.c
#include "BLT_translation.h"
0dafa97ea3f6d9662299579e5be1875cd28baaae 48 26 1

3d57bc4397fca53bc9702a27bbf50102827829b0 27 27 1
author Hans Goudey
author-mail <hans@blender.org>
author-time 1700131315
author-tz +0100
committer Hans Goudey
committer-mail <hooglyboogly@noreply.localhost>
committer-time 1700131315
committer-tz +0100
summary Cleanup: Move several blenkernel headers to C++
previous 451c054d9b7d3148a646caa5a72fb127a5b5c408 source/blender/editors/interface/interface_ops.cc
filename source/blender/editors/interface/interface_ops.cc
#include "BKE_context.hh"
```
This PR reuses data from the previous blame part to fill these gaps.

authored by

KN4CK3R and committed by
GitHub
31426938 177cea7c

+17 -5
+17 -5
routers/web/repo/blame.go
··· 125 125 } 126 126 127 127 type blameResult struct { 128 - Parts []git.BlamePart 128 + Parts []*git.BlamePart 129 129 UsesIgnoreRevs bool 130 130 FaultyIgnoreRevsFile bool 131 131 } ··· 175 175 func fillBlameResult(br *git.BlameReader, r *blameResult) error { 176 176 r.UsesIgnoreRevs = br.UsesIgnoreRevs() 177 177 178 - r.Parts = make([]git.BlamePart, 0, 5) 178 + previousHelper := make(map[string]*git.BlamePart) 179 + 180 + r.Parts = make([]*git.BlamePart, 0, 5) 179 181 for { 180 182 blamePart, err := br.NextPart() 181 183 if err != nil { ··· 184 186 if blamePart == nil { 185 187 break 186 188 } 187 - r.Parts = append(r.Parts, *blamePart) 189 + 190 + if prev, ok := previousHelper[blamePart.Sha]; ok { 191 + if blamePart.PreviousSha == "" { 192 + blamePart.PreviousSha = prev.PreviousSha 193 + blamePart.PreviousPath = prev.PreviousPath 194 + } 195 + } else { 196 + previousHelper[blamePart.Sha] = blamePart 197 + } 198 + 199 + r.Parts = append(r.Parts, blamePart) 188 200 } 189 201 190 202 return nil 191 203 } 192 204 193 - func processBlameParts(ctx *context.Context, blameParts []git.BlamePart) map[string]*user_model.UserCommit { 205 + func processBlameParts(ctx *context.Context, blameParts []*git.BlamePart) map[string]*user_model.UserCommit { 194 206 // store commit data by SHA to look up avatar info etc 195 207 commitNames := make(map[string]*user_model.UserCommit) 196 208 // and as blameParts can reference the same commits multiple ··· 232 244 return commitNames 233 245 } 234 246 235 - func renderBlame(ctx *context.Context, blameParts []git.BlamePart, commitNames map[string]*user_model.UserCommit) { 247 + func renderBlame(ctx *context.Context, blameParts []*git.BlamePart, commitNames map[string]*user_model.UserCommit) { 236 248 repoLink := ctx.Repo.RepoLink 237 249 238 250 language := ""