File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ public partial class QueryStagedChangesWithAmend : Command
1111 [ GeneratedRegex ( @"^:[\d]{6} ([\d]{6}) ([0-9a-f]{40}) [0-9a-f]{40} R\d{0,6}\t(.*\t.*)$" ) ]
1212 private static partial Regex REG_FORMAT2 ( ) ;
1313
14- public QueryStagedChangesWithAmend ( string repo )
14+ public QueryStagedChangesWithAmend ( string repo , string parent )
1515 {
1616 WorkingDirectory = repo ;
1717 Context = repo ;
18- Args = "diff-index --cached -M HEAD^ " ;
18+ Args = $ "diff-index --cached -M { parent } ";
1919 }
2020
2121 public List < Models . Change > Result ( )
Original file line number Diff line number Diff line change @@ -1524,7 +1524,10 @@ public ContextMenu CreateContextForOpenAI()
15241524 private List < Models . Change > GetStagedChanges ( )
15251525 {
15261526 if ( _useAmend )
1527- return new Commands . QueryStagedChangesWithAmend ( _repo . FullPath ) . Result ( ) ;
1527+ {
1528+ var head = new Commands . QuerySingleCommit ( _repo . FullPath , "HEAD" ) . Result ( ) ;
1529+ return new Commands . QueryStagedChangesWithAmend ( _repo . FullPath , head . Parents . Count == 0 ? "4b825dc642cb6eb9a060e54bf8d69288fbee4904" : "HEAD^" ) . Result ( ) ;
1530+ }
15281531
15291532 var rs = new List < Models . Change > ( ) ;
15301533 foreach ( var c in _cached )
You can’t perform that action at this time.
0 commit comments