@@ -4,9 +4,12 @@ use std::{
44 sync:: Arc ,
55} ;
66
7- use api_model:: git:: commit:: LatestCommitInfo ;
8- use common:: model:: { CommonPage , DiffItem , Pagination } ;
7+ use api_model:: {
8+ common:: { CommonPage , Pagination } ,
9+ git:: commit:: LatestCommitInfo ,
10+ } ;
911use git_internal:: {
12+ DiffItem ,
1013 errors:: GitError ,
1114 hash:: ObjectHash ,
1215 internal:: object:: {
@@ -20,7 +23,7 @@ use serde::{Deserialize, Serialize};
2023use crate :: {
2124 api_service:: { ApiHandler , history, tree_ops} ,
2225 model:: {
23- change_list:: MuiTreeNode ,
26+ change_list:: { DiffItemSchema , MuiTreeNode } ,
2427 commit:: { CommitFilesChangedPage , CommitSummary , GpgStatus } ,
2528 git:: { CommitBindingInfo , LatestCommitInfoWrapper } ,
2629 } ,
@@ -749,13 +752,13 @@ async fn compute_commit_diff_items<T: ApiHandler + ?Sized>(
749752 merged
750753 } ;
751754
752- Ok ( diff_results. into_iter ( ) . map ( Into :: into ) . collect ( ) )
755+ Ok ( diff_results. into_iter ( ) . collect ( ) )
753756}
754757
755758#[ derive( Serialize , Deserialize ) ]
756759struct CachedDiff {
757760 filter_paths : Option < Vec < String > > ,
758- items : Vec < DiffItem > ,
761+ items : Vec < DiffItemSchema > ,
759762}
760763
761764async fn load_or_compute_diff_items < T : ApiHandler + ?Sized > (
@@ -764,7 +767,7 @@ async fn load_or_compute_diff_items<T: ApiHandler + ?Sized>(
764767 commit_sha : & str ,
765768 cache_key : & str ,
766769 filter_paths : Option < & [ String ] > ,
767- ) -> Result < Vec < DiffItem > , GitError > {
770+ ) -> Result < Vec < DiffItemSchema > , GitError > {
768771 let requested_filter = filter_paths. map ( |paths| {
769772 let mut v: Vec < String > = paths. iter ( ) . map ( |p| p. to_string ( ) ) . collect ( ) ;
770773 v. sort ( ) ;
@@ -793,6 +796,8 @@ async fn load_or_compute_diff_items<T: ApiHandler + ?Sized>(
793796 compute_commit_diff_items ( handler, & commit, filter_paths) . await ?
794797 } ;
795798
799+ let diffs: Vec < DiffItemSchema > = diffs. clone ( ) . into_iter ( ) . map ( |x| x. into ( ) ) . collect ( ) ;
800+
796801 let cache_value = CachedDiff {
797802 filter_paths : requested_filter,
798803 items : diffs. clone ( ) ,
0 commit comments