From e69478bcd7e2d22a56c6b4a0b4f8983b23293d93 Mon Sep 17 00:00:00 2001 From: hiifong Date: Tue, 14 Jan 2025 21:27:05 +0800 Subject: [PATCH] Update --- services/gitdiff/gitdiff.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index a411f643e8bb2..f046e596782f0 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -1136,10 +1136,11 @@ func GetDiff(ctx context.Context, gitRepo *git.Repository, opts *DiffOptions, fi } else { actualBeforeCommitID := opts.BeforeCommitID if len(actualBeforeCommitID) == 0 { - parentCommit, _ := commit.Parent(0) - if parentCommit != nil { - actualBeforeCommitID = parentCommit.ID.String() + parentCommit, err := commit.Parent(0) + if err != nil { + return nil, err } + actualBeforeCommitID = parentCommit.ID.String() } cmdDiff.AddArguments("diff", "--src-prefix=\\a/", "--dst-prefix=\\b/", "-M").