@@ -151,7 +151,7 @@ private string FindCommitIdIfPushed(IGitUICommands commands, string head, int he
151
151
152
152
private string FindCommitId ( IGitUICommands commands , string head , int headOffset )
153
153
{
154
- string commitId = commands . GitModule . RunGitCmd ( $ "rev-parse { head } ~{ headOffset } ") . Trim ( ) ;
154
+ string commitId = RunGitCommand ( commands , $ "rev-parse { head } ~{ headOffset } ") . Trim ( ) ;
155
155
if ( ! String . IsNullOrWhiteSpace ( commitId ) && ! commitId . Contains ( " " ) )
156
156
return commitId ;
157
157
@@ -164,7 +164,9 @@ private bool IsCommitPushed(IGitUICommands commands, string head, int headOffset
164
164
if ( String . IsNullOrEmpty ( commitId ) )
165
165
return true ;
166
166
167
- string branches = commands . GitModule . RunGitCmd ( $ "branch -r --contains { commitId } ") ;
167
+
168
+
169
+ string branches = RunGitCommand ( commands , $ "branch -r --contains { commitId } ") ;
168
170
if ( String . IsNullOrWhiteSpace ( branches ) )
169
171
return false ;
170
172
@@ -211,5 +213,19 @@ private int BinarySearch(int start, int end, Func<int, int> predicate)
211
213
throw Ensure . Exception . NotSupported ( "BinarySearch predicate must return -1, 0 or 1." ) ;
212
214
}
213
215
}
216
+
217
+ private string RunGitCommand ( IGitUICommands commands , string arguments )
218
+ {
219
+ using ( IProcess process = commands . GitModule . GitCommandRunner . RunDetached ( arguments , redirectOutput : true ) )
220
+ {
221
+ process . WaitForExit ( ) ;
222
+
223
+ string error = process . StandardError . ReadToEnd ( ) ;
224
+ if ( ! String . IsNullOrEmpty ( error ) )
225
+ return error ;
226
+
227
+ return process . StandardOutput . ReadToEnd ( ) ;
228
+ }
229
+ }
214
230
}
215
231
}
0 commit comments