@@ -27,6 +27,7 @@ use crate::params::{
27
27
self , app_data, df_opts_query, parse_base_head, path_param, resolve_base_head, DFOptsQuery ,
28
28
PageNumQuery ,
29
29
} ;
30
+ use liboxen:: model:: entry:: commit_entry:: CompareEntry ;
30
31
31
32
pub async fn commits (
32
33
req : HttpRequest ,
@@ -166,15 +167,26 @@ pub async fn create_df_compare(
166
167
OxenError :: ResourceNotFound ( format ! ( "{}@{}" , resource_2. display( ) , commit_2) . into ( ) )
167
168
} ) ?;
168
169
170
+ let cpath_1 = CompareEntry {
171
+ commit_entry : Some ( entry_1) ,
172
+ path : resource_1,
173
+ } ;
174
+
175
+ let cpath_2 = CompareEntry {
176
+ commit_entry : Some ( entry_2) ,
177
+ path : resource_2,
178
+ } ;
179
+
169
180
let compare = api:: local:: compare:: compare_files (
170
181
& repository,
171
182
Some ( & compare_id) ,
172
- entry_1 ,
173
- entry_2 ,
183
+ cpath_1 ,
184
+ cpath_2 ,
174
185
keys,
175
186
targets,
176
187
None ,
177
- ) ?;
188
+ ) ?
189
+ . ok_or_else ( || OxenError :: basic_str ( "Error creating comparison" ) ) ?;
178
190
179
191
let mut messages: Vec < OxenMessage > = vec ! [ ] ;
180
192
@@ -227,11 +239,21 @@ pub async fn get_df_compare(
227
239
OxenError :: ResourceNotFound ( format ! ( "{}@{}" , data. right_resource, right_commit) . into ( ) )
228
240
} ) ?;
229
241
242
+ let cpath_1 = CompareEntry {
243
+ commit_entry : Some ( left_entry. clone ( ) ) ,
244
+ path : left_entry. path ,
245
+ } ;
246
+
247
+ let cpath_2 = CompareEntry {
248
+ commit_entry : Some ( right_entry. clone ( ) ) ,
249
+ path : right_entry. path ,
250
+ } ;
251
+
230
252
let maybe_cached_compare = api:: local:: compare:: get_cached_compare (
231
253
& repository,
232
254
& compare_id,
233
- & left_entry ,
234
- & right_entry ,
255
+ cpath_1 . clone ( ) ,
256
+ cpath_2 . clone ( ) ,
235
257
) ?;
236
258
237
259
let view = match maybe_cached_compare {
@@ -254,12 +276,13 @@ pub async fn get_df_compare(
254
276
let compare = api:: local:: compare:: compare_files (
255
277
& repository,
256
278
Some ( & compare_id) ,
257
- left_entry ,
258
- right_entry ,
279
+ cpath_1 ,
280
+ cpath_2 ,
259
281
data. keys ,
260
282
data. targets ,
261
283
None ,
262
- ) ?;
284
+ ) ?
285
+ . ok_or_else ( || OxenError :: basic_str ( "Error creating comparison" ) ) ?;
263
286
264
287
let mut messages: Vec < OxenMessage > = vec ! [ ] ;
265
288
0 commit comments