@@ -159,31 +159,50 @@ pub fn render(
159159 }
160160
161161 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 ( ) ) ?;
163163 if cmd == "get" {
164- return Ok ( Some ( template . to_string ( ) ) ) ;
164+ return Ok ( Some ( file . to_string ( ) ) ) ;
165165 }
166166 if cmd == "graphql" {
167167 let mut variables = juniper:: Variables :: new ( ) ;
168168
169169 for ( k, v) in params {
170170 variables. insert ( k. to_string ( ) , juniper:: InputValue :: scalar ( v) ) ;
171171 }
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+ ) ?;
174193 let ( res, _errors) = juniper:: execute_sync (
175- template ,
194+ file ,
176195 None ,
177196 & graphql:: commit_schema ( commit_id) ,
178197 & variables,
179- & graphql:: context ( transaction, transaction_overlay ) ,
198+ & graphql:: context ( transaction, transaction_mirror ) ,
180199 ) ?;
181200
182201 let j = serde_json:: to_string_pretty ( & res) ?;
183202 return Ok ( Some ( j) ) ;
184203 }
185204 if cmd == "render" {
186- template . to_string ( )
205+ file . to_string ( )
187206 } else {
188207 return Err ( josh_error ( "no such cmd" ) ) ;
189208 }
0 commit comments