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
11
11
[ GeneratedRegex ( @"^:[\d]{6} ([\d]{6}) ([0-9a-f]{40}) [0-9a-f]{40} R\d{0,6}\t(.*\t.*)$" ) ]
12
12
private static partial Regex REG_FORMAT2 ( ) ;
13
13
14
- public QueryStagedChangesWithAmend ( string repo )
14
+ public QueryStagedChangesWithAmend ( string repo , string parent )
15
15
{
16
16
WorkingDirectory = repo ;
17
17
Context = repo ;
18
- Args = "diff-index --cached -M HEAD^ " ;
18
+ Args = $ "diff-index --cached -M { parent } ";
19
19
}
20
20
21
21
public List < Models . Change > Result ( )
Original file line number Diff line number Diff line change @@ -1524,7 +1524,10 @@ public ContextMenu CreateContextForOpenAI()
1524
1524
private List < Models . Change > GetStagedChanges ( )
1525
1525
{
1526
1526
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
+ }
1528
1531
1529
1532
var rs = new List < Models . Change > ( ) ;
1530
1533
foreach ( var c in _cached )
You can’t perform that action at this time.
0 commit comments