@@ -33,7 +33,6 @@ public QueryCommits(string repo, int maxCount, string messageFilter, bool isFile
3333 argsBuilder . Append ( "--all-match -i" ) ;
3434 search = argsBuilder . ToString ( ) ;
3535 }
36-
3736
3837 WorkingDirectory = repo ;
3938 Context = repo ;
@@ -63,7 +62,9 @@ public QueryCommits(string repo, int maxCount, string messageFilter, bool isFile
6362 ParseParent ( line ) ;
6463 break ;
6564 case 2 :
66- ParseDecorators ( line ) ;
65+ _current . ParseDecorators ( line ) ;
66+ if ( _current . IsMerged && ! _isHeadFounded )
67+ _isHeadFounded = true ;
6768 break ;
6869 case 3 :
6970 _current . Author = Models . User . FindOrAdd ( line ) ;
@@ -114,74 +115,6 @@ private void ParseParent(string data)
114115 _current . Parents . Add ( data . Substring ( idx + 1 ) ) ;
115116 }
116117
117- private void ParseDecorators ( string data )
118- {
119- if ( data . Length < 3 )
120- return ;
121-
122- var subs = data . Split ( ',' , StringSplitOptions . RemoveEmptyEntries ) ;
123- foreach ( var sub in subs )
124- {
125- var d = sub . Trim ( ) ;
126- if ( d . EndsWith ( "/HEAD" , StringComparison . Ordinal ) )
127- continue ;
128-
129- if ( d . StartsWith ( "tag: refs/tags/" , StringComparison . Ordinal ) )
130- {
131- _current . Decorators . Add ( new Models . Decorator ( )
132- {
133- Type = Models . DecoratorType . Tag ,
134- Name = d . Substring ( 15 ) ,
135- } ) ;
136- }
137- else if ( d . StartsWith ( "HEAD -> refs/heads/" , StringComparison . Ordinal ) )
138- {
139- _current . IsMerged = true ;
140- _current . Decorators . Add ( new Models . Decorator ( )
141- {
142- Type = Models . DecoratorType . CurrentBranchHead ,
143- Name = d . Substring ( 19 ) ,
144- } ) ;
145- }
146- else if ( d . Equals ( "HEAD" ) )
147- {
148- _current . IsMerged = true ;
149- _current . Decorators . Add ( new Models . Decorator ( )
150- {
151- Type = Models . DecoratorType . CurrentCommitHead ,
152- Name = d ,
153- } ) ;
154- }
155- else if ( d . StartsWith ( "refs/heads/" , StringComparison . Ordinal ) )
156- {
157- _current . Decorators . Add ( new Models . Decorator ( )
158- {
159- Type = Models . DecoratorType . LocalBranchHead ,
160- Name = d . Substring ( 11 ) ,
161- } ) ;
162- }
163- else if ( d . StartsWith ( "refs/remotes/" , StringComparison . Ordinal ) )
164- {
165- _current . Decorators . Add ( new Models . Decorator ( )
166- {
167- Type = Models . DecoratorType . RemoteBranchHead ,
168- Name = d . Substring ( 13 ) ,
169- } ) ;
170- }
171- }
172-
173- _current . Decorators . Sort ( ( l , r ) =>
174- {
175- if ( l . Type != r . Type )
176- return ( int ) l . Type - ( int ) r . Type ;
177- else
178- return string . Compare ( l . Name , r . Name , StringComparison . Ordinal ) ;
179- } ) ;
180-
181- if ( _current . IsMerged && ! _isHeadFounded )
182- _isHeadFounded = true ;
183- }
184-
185118 private void MarkFirstMerged ( )
186119 {
187120 Args = $ "log --since=\" { _commits [ ^ 1 ] . CommitterTimeStr } \" --format=\" %H\" ";
0 commit comments