File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,35 @@ mod tests {
318318 Ok ( ( ) )
319319 }
320320
321+ // File deletions should work correctly even if a relative revision is
322+ // specified.
323+ #[ test]
324+ fn deleted_files_relative_revision ( ) -> Result < ( ) > {
325+ let git = GitCheckout :: new ( ) ?;
326+ git. write_file ( "test_1.txt" , "Initial commit" ) ?;
327+ git. write_file ( "test_2.txt" , "Initial commit" ) ?;
328+ git. write_file ( "test_3.txt" , "Initial commit" ) ?;
329+
330+ git. add ( "." ) ?;
331+ git. commit ( "commit 1" ) ?;
332+
333+ git. rm_file ( "test_1.txt" ) ?;
334+
335+ let files = git. changed_files ( None ) ?;
336+ assert_eq ! ( files. len( ) , 0 ) ;
337+
338+ git. add ( "." ) ?;
339+ git. commit ( "removal commit" ) ?;
340+
341+ git. write_file ( "test_2.txt" , "Initial commit" ) ?;
342+ git. add ( "." ) ?;
343+ git. commit ( "another commit" ) ?;
344+
345+ let files = git. changed_files ( Some ( "HEAD~2" ) ) ?;
346+ assert_eq ! ( files. len( ) , 1 ) ;
347+ Ok ( ( ) )
348+ }
349+
321350 #[ test]
322351 fn merge_base_with ( ) -> Result < ( ) > {
323352 let git = GitCheckout :: new ( ) ?;
You can’t perform that action at this time.
0 commit comments