@@ -8,12 +8,12 @@ namespace SourceGit.Commands
88{
99 public class QueryCommits : Command
1010 {
11- public QueryCommits ( string repo , string limits , bool needFindHead = true )
11+ public QueryCommits ( string repo , string limits , bool markMerged = true )
1212 {
1313 WorkingDirectory = repo ;
1414 Context = repo ;
1515 Args = $ "log --no-show-signature --decorate=full --format=%H%x00%P%x00%D%x00%aN±%aE%x00%at%x00%cN±%cE%x00%ct%x00%s { limits } ";
16- _findFirstMerged = needFindHead ;
16+ _markMerged = markMerged ;
1717 }
1818
1919 public QueryCommits ( string repo , string filter , Models . CommitSearchMethod method , bool onlyCurrentBranch )
@@ -51,7 +51,7 @@ public QueryCommits(string repo, string filter, Models.CommitSearchMethod method
5151 WorkingDirectory = repo ;
5252 Context = repo ;
5353 Args = builder . ToString ( ) ;
54- _findFirstMerged = false ;
54+ _markMerged = false ;
5555 }
5656
5757 public async Task < List < Models . Commit > > GetResultAsync ( )
@@ -63,6 +63,7 @@ public QueryCommits(string repo, string filter, Models.CommitSearchMethod method
6363 proc . StartInfo = CreateGitStartInfo ( true ) ;
6464 proc . Start ( ) ;
6565
66+ var findHead = false ;
6667 while ( await proc . StandardOutput . ReadLineAsync ( ) . ConfigureAwait ( false ) is { } line )
6768 {
6869 var parts = line . Split ( '\0 ' ) ;
@@ -79,13 +80,12 @@ public QueryCommits(string repo, string filter, Models.CommitSearchMethod method
7980 commit . Subject = parts [ 7 ] ;
8081 commits . Add ( commit ) ;
8182
82- if ( commit . IsMerged && ! _isHeadFound )
83- _isHeadFound = true ;
83+ findHead |= commit . IsMerged ;
8484 }
8585
8686 await proc . WaitForExitAsync ( ) . ConfigureAwait ( false ) ;
8787
88- if ( _findFirstMerged && ! _isHeadFound && commits . Count > 0 )
88+ if ( _markMerged && ! findHead && commits . Count > 0 )
8989 {
9090 var set = await new QueryCurrentBranchCommitHashes ( WorkingDirectory , commits [ ^ 1 ] . CommitterTime )
9191 . GetResultAsync ( )
@@ -109,7 +109,6 @@ public QueryCommits(string repo, string filter, Models.CommitSearchMethod method
109109 return commits ;
110110 }
111111
112- private bool _findFirstMerged = false ;
113- private bool _isHeadFound = false ;
112+ private bool _markMerged = false ;
114113 }
115114}
0 commit comments