From 0bfffa0ad849501635b6789eb09bd9d7849487cd Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 14 Nov 2024 16:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9:compare=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=A7=BB=E9=99=A4diff=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/hat/repo/repo.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routers/hat/repo/repo.go b/routers/hat/repo/repo.go index fe41163..0ad12cf 100644 --- a/routers/hat/repo/repo.go +++ b/routers/hat/repo/repo.go @@ -98,13 +98,15 @@ type CompareCommit struct { } func CompareDiff(ctx *context.APIContext) { - headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch := ParseCompareInfo(ctx) + // headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch := ParseCompareInfo(ctx) + _, _, headGitRepo, compareInfo, _, _ := ParseCompareInfo(ctx) + if ctx.Written() { return } defer headGitRepo.Close() - _ = PrepareComapreDiff(ctx, headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch) + // _ = PrepareComapreDiff(ctx, headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch) result := make([]CompareCommit, 0) for _, commit := range compareInfo.Commits { @@ -123,13 +125,15 @@ func CompareDiff(ctx *context.APIContext) { Diff interface{} CommitsCount int Latestsha string + FilesCount int }{ Commits: result, - Diff: ctx.Data["Diff"], + // Diff: ctx.Data["Diff"], } different.CommitsCount = len(compareInfo.Commits) different.Latestsha = compareInfo.HeadCommitID + different.FilesCount = compareInfo.NumFiles ctx.JSON(http.StatusOK, different) }