diff --git a/kernel/model/repository.go b/kernel/model/repository.go index ca96ff085..0fddbda55 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -128,12 +128,12 @@ func OpenRepoSnapshotDoc(fileID string) (id, rootID, content string, isLargeDoc } type LeftRightDiff struct { - LeftIndex *entity.Index `json:"leftIndex"` - RightIndex *entity.Index `json:"rightIndex"` - AddsLeft []*DiffFile `json:"addsLeft"` - UpdatesLeft []*DiffFile `json:"updatesLeft"` - UpdatesRight []*DiffFile `json:"updatesRight"` - RemovesRight []*DiffFile `json:"removesRight"` + LeftIndex *DiffIndex `json:"leftIndex"` + RightIndex *DiffIndex `json:"rightIndex"` + AddsLeft []*DiffFile `json:"addsLeft"` + UpdatesLeft []*DiffFile `json:"updatesLeft"` + UpdatesRight []*DiffFile `json:"updatesRight"` + RemovesRight []*DiffFile `json:"removesRight"` } type DiffFile struct { @@ -141,6 +141,11 @@ type DiffFile struct { Title string `json:"title"` } +type DiffIndex struct { + ID string `json:"id"` + Created int64 `json:"created"` +} + func DiffRepoSnapshots(left, right string) (ret *LeftRightDiff, err error) { if 1 > len(Conf.Repo.Key) { err = errors.New(Conf.Language(26)) @@ -157,12 +162,15 @@ func DiffRepoSnapshots(left, right string) (ret *LeftRightDiff, err error) { return } - diff.LeftIndex.Files = nil - diff.RightIndex.Files = nil - ret = &LeftRightDiff{ - LeftIndex: diff.LeftIndex, - RightIndex: diff.RightIndex, + LeftIndex: &DiffIndex{ + ID: diff.LeftIndex.ID, + Created: diff.LeftIndex.Created, + }, + RightIndex: &DiffIndex{ + ID: diff.RightIndex.ID, + Created: diff.RightIndex.Created, + }, } luteEngine := NewLute() for _, addLeft := range diff.AddsLeft {