@@ -32,6 +32,16 @@ describe('getDiff', () => {
3232 } ) ;
3333
3434 it ( 'should get diff between commits' , async ( ) => {
35+ // Ensure we have a known state: write initial content, then modify it
36+ await fs . writeFile ( path . join ( tempDir , 'test.txt' ) , 'initial content' ) ;
37+ await git . add ( '.' ) ;
38+ // Use --allow-empty or amend to handle case where content is already 'initial content'
39+ try {
40+ await git . commit ( 'reset to initial' ) ;
41+ } catch {
42+ // no changes to commit - that's fine
43+ }
44+
3545 await fs . writeFile ( path . join ( tempDir , 'test.txt' ) , 'modified content' ) ;
3646 await git . add ( '.' ) ;
3747 await git . commit ( 'second commit' ) ;
@@ -51,6 +61,15 @@ describe('getDiff', () => {
5161 } ) ;
5262
5363 it ( 'should get diff between commits with no changes' , async ( ) => {
64+ // Create a known two-commit state: initial -> same content commit
65+ await fs . writeFile ( path . join ( tempDir , 'test-nochange.txt' ) , 'initial content' ) ;
66+ await git . add ( '.' ) ;
67+ await git . commit ( 'base commit for no-change test' ) ;
68+
69+ await fs . writeFile ( path . join ( tempDir , 'test-nochange2.txt' ) , 'more initial content' ) ;
70+ await git . add ( '.' ) ;
71+ await git . commit ( 'second commit for no-change test' ) ;
72+
5473 const action = new Action ( '1234567890' , 'push' , 'POST' , 1234567890 , 'test/repo.git' ) ;
5574 action . proxyGitPath = __dirname ; // Temp dir parent path
5675 action . repoName = 'temp-test-repo' ;
0 commit comments