@@ -159,31 +159,50 @@ pub fn render(
159
159
}
160
160
161
161
let template = if let Ok ( blob) = obj. peel_to_blob ( ) {
162
- let template = std:: str:: from_utf8 ( blob. content ( ) ) ?;
162
+ let file = std:: str:: from_utf8 ( blob. content ( ) ) ?;
163
163
if cmd == "get" {
164
- return Ok ( Some ( template . to_string ( ) ) ) ;
164
+ return Ok ( Some ( file . to_string ( ) ) ) ;
165
165
}
166
166
if cmd == "graphql" {
167
167
let mut variables = juniper:: Variables :: new ( ) ;
168
168
169
169
for ( k, v) in params {
170
170
variables. insert ( k. to_string ( ) , juniper:: InputValue :: scalar ( v) ) ;
171
171
}
172
- let transaction = cache:: Transaction :: open ( transaction. repo ( ) . path ( ) , None ) ?;
173
- let transaction_overlay = cache:: Transaction :: open ( transaction. repo ( ) . path ( ) , None ) ?;
172
+ let transaction_mirror = cache:: Transaction :: open ( transaction. repo ( ) . path ( ) , None ) ?;
173
+ let transaction = cache:: Transaction :: open (
174
+ & transaction
175
+ . repo ( )
176
+ . path ( )
177
+ . parent ( )
178
+ . ok_or ( josh_error ( "parent" ) ) ?
179
+ . join ( "overlay" ) ,
180
+ None ,
181
+ ) ?;
182
+ transaction. repo ( ) . odb ( ) ?. add_disk_alternate (
183
+ transaction
184
+ . repo ( )
185
+ . path ( )
186
+ . parent ( )
187
+ . ok_or ( josh_error ( "parent" ) ) ?
188
+ . join ( "mirror" )
189
+ . join ( "objects" )
190
+ . to_str ( )
191
+ . unwrap ( ) ,
192
+ ) ?;
174
193
let ( res, _errors) = juniper:: execute_sync (
175
- template ,
194
+ file ,
176
195
None ,
177
196
& graphql:: commit_schema ( commit_id) ,
178
197
& variables,
179
- & graphql:: context ( transaction, transaction_overlay ) ,
198
+ & graphql:: context ( transaction, transaction_mirror ) ,
180
199
) ?;
181
200
182
201
let j = serde_json:: to_string_pretty ( & res) ?;
183
202
return Ok ( Some ( j) ) ;
184
203
}
185
204
if cmd == "render" {
186
- template . to_string ( )
205
+ file . to_string ( )
187
206
} else {
188
207
return Err ( josh_error ( "no such cmd" ) ) ;
189
208
}
0 commit comments