@@ -17,9 +17,13 @@ public IEnumerable<GitChange> GetChangedFiles()
1717 var defaultBranch = GetDefaultBranch ( ) ;
1818 var commitChanges = CaptureMultiple ( "git" , "diff" , "--name-status" , $ "{ defaultBranch } ...HEAD", "--" , $ "./{ LookupPath } ") ;
1919 var localChanges = CaptureMultiple ( "git" , "status" , "--porcelain" ) ;
20- ExecInSilent ( [ ] , "git" , "stash" , "push" , "--" , $ "./{ LookupPath } ") ;
21- var localUnstagedChanges = CaptureMultiple ( "git" , "stash" , "show" , "--name-status" , "-u" ) ;
22- ExecInSilent ( [ ] , "git" , "stash" , "pop" ) ;
20+ var captured = Capture ( "git" , "stash" , "push" , "--" , $ "./{ LookupPath } ") ;
21+ var localUnstagedChanges = Array . Empty < string > ( ) ;
22+ if ( captured != "No local changes to save" )
23+ {
24+ localUnstagedChanges = CaptureMultiple ( "git" , "stash" , "show" , "--name-status" , "-u" ) ;
25+ ExecInSilent ( [ ] , "git" , "stash" , "pop" ) ;
26+ }
2327
2428 return [ .. GetCommitChanges ( commitChanges ) , .. GetLocalChanges ( localChanges ) , .. GetCommitChanges ( localUnstagedChanges ) ] ;
2529 }
0 commit comments