1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-05 01:45:22 +02:00

Monitor all git commands; move blame to git package and replace git as a variable (#6864)

* monitor all git commands; move blame to git package and replace git as a variable

* use git command but not other commands

* fix build

* move exec.Command to git.NewCommand

* fix fmt

* remove unrelated changes

* remove unrelated changes

* refactor IsEmpty and add tests

* fix tests

* fix tests

* fix tests

* fix tests

* remove gitLogger

* fix fmt

* fix isEmpty

* fix lint

* fix tests
This commit is contained in:
Lunny Xiao 2019-06-27 02:15:26 +08:00 committed by techknowlogick
parent 161e12e157
commit edc94c7041
34 changed files with 750 additions and 74 deletions

View file

@ -131,14 +131,14 @@ func RefBlame(ctx *context.Context) {
ctx.Data["FileSize"] = blob.Size()
ctx.Data["FileName"] = blob.Name()
blameReader, err := models.CreateBlameReader(models.RepoPath(userName, repoName), commitID, fileName)
blameReader, err := git.CreateBlameReader(models.RepoPath(userName, repoName), commitID, fileName)
if err != nil {
ctx.NotFound("CreateBlameReader", err)
return
}
defer blameReader.Close()
blameParts := make([]models.BlamePart, 0)
blameParts := make([]git.BlamePart, 0)
for {
blamePart, err := blameReader.NextPart()
@ -189,7 +189,7 @@ func RefBlame(ctx *context.Context) {
ctx.HTML(200, tplBlame)
}
func renderBlame(ctx *context.Context, blameParts []models.BlamePart, commitNames map[string]models.UserCommit) {
func renderBlame(ctx *context.Context, blameParts []git.BlamePart, commitNames map[string]models.UserCommit) {
repoLink := ctx.Repo.RepoLink
var lines = make([]string, 0)