@@ -120,8 +120,12 @@ impl<'a> TestFile<'a> {
120120 } ;
121121 }
122122
123- // Run blame to get authorship
124- let filename = file_path. to_str ( ) . expect ( "valid path" ) ;
123+ // Run blame to get authorship - use relative path from repo root
124+ let filename = file_path
125+ . strip_prefix ( & repo. path )
126+ . expect ( "file path should be within repo" )
127+ . to_str ( )
128+ . expect ( "valid path" ) ;
125129 let blame_result = repo. git_ai ( & [ "blame" , filename] ) ;
126130
127131 let lines = if let Ok ( blame_output) = blame_result {
@@ -213,7 +217,11 @@ impl<'a> TestFile<'a> {
213217 }
214218
215219 pub fn assert_blame_snapshot ( & self ) {
216- let filename = self . file_path . to_str ( ) . expect ( "valid path" ) ;
220+ let filename = self . file_path
221+ . strip_prefix ( & self . repo . path )
222+ . expect ( "file path should be within repo" )
223+ . to_str ( )
224+ . expect ( "valid path" ) ;
217225 let blame_output = self
218226 . repo
219227 . git_ai ( & [ "blame" , filename] )
@@ -226,8 +234,12 @@ impl<'a> TestFile<'a> {
226234 pub fn assert_lines_and_blame < T : Into < ExpectedLine > > ( & mut self , lines : Vec < T > ) {
227235 let expected_lines: Vec < ExpectedLine > = lines. into_iter ( ) . map ( |l| l. into ( ) ) . collect ( ) ;
228236
229- // Get blame output
230- let filename = self . file_path . to_str ( ) . expect ( "valid path" ) ;
237+ // Get blame output - use relative path from repo root
238+ let filename = self . file_path
239+ . strip_prefix ( & self . repo . path )
240+ . expect ( "file path should be within repo" )
241+ . to_str ( )
242+ . expect ( "valid path" ) ;
231243 let blame_output = self
232244 . repo
233245 . git_ai ( & [ "blame" , filename] )
@@ -300,8 +312,12 @@ impl<'a> TestFile<'a> {
300312 pub fn assert_committed_lines < T : Into < ExpectedLine > > ( & mut self , lines : Vec < T > ) {
301313 let expected_lines: Vec < ExpectedLine > = lines. into_iter ( ) . map ( |l| l. into ( ) ) . collect ( ) ;
302314
303- // Get blame output
304- let filename = self . file_path . to_str ( ) . expect ( "valid path" ) ;
315+ // Get blame output - use relative path from repo root
316+ let filename = self . file_path
317+ . strip_prefix ( & self . repo . path )
318+ . expect ( "file path should be within repo" )
319+ . to_str ( )
320+ . expect ( "valid path" ) ;
305321 let blame_output = self
306322 . repo
307323 . git_ai ( & [ "blame" , filename] )
@@ -430,8 +446,12 @@ impl<'a> TestFile<'a> {
430446
431447 /// Assert that the file at the given path matches the expected contents and authorship
432448 pub fn assert_blame_contents_expected ( & self ) {
433- // Get blame output
434- let filename = self . file_path . to_str ( ) . expect ( "valid path" ) ;
449+ // Get blame output - use relative path from repo root
450+ let filename = self . file_path
451+ . strip_prefix ( & self . repo . path )
452+ . expect ( "file path should be within repo" )
453+ . to_str ( )
454+ . expect ( "valid path" ) ;
435455 let blame_output = self
436456 . repo
437457 . git_ai ( & [ "blame" , filename] )
0 commit comments