From cddac5381d50c40abcbe9e4e5a6cf6ec4aded4ee Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 17 Feb 2023 11:28:11 +0800 Subject: [PATCH] fix --- services/gitdiff/csv.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/gitdiff/csv.go b/services/gitdiff/csv.go index 5781d7e9094ae..1af4f62e674c9 100644 --- a/services/gitdiff/csv.go +++ b/services/gitdiff/csv.go @@ -119,8 +119,12 @@ func CreateCsvDiff(diffFile *DiffFile, baseReader, headReader *csv.Reader) ([]*T if baseReader != nil { return createCsvDiffSingle(baseReader, TableDiffCellDel) + } else if headReader != nil { + return createCsvDiffSingle(headReader, TableDiffCellAdd) } - return createCsvDiffSingle(headReader, TableDiffCellAdd) + // If a CSV file was deleted from both branches, then baseReader and headReader are nil, no need to "diff" them + // The UI will show a "deleted" change correctly. + return nil, nil } // createCsvDiffSingle creates a tabular diff based on a single CSV reader. All cells are added or deleted.