17
17
import com .devonfw .tools .ide .log .IdeSubLogger ;
18
18
import com .devonfw .tools .ide .process .ProcessContext ;
19
19
import com .devonfw .tools .ide .process .ProcessErrorHandling ;
20
+ import com .devonfw .tools .ide .process .ProcessMode ;
20
21
import com .devonfw .tools .ide .process .ProcessResult ;
21
22
22
23
/**
@@ -96,7 +97,7 @@ public void pullOrClone(String gitRepoUrl, Path targetRepository) {
96
97
initializeProcessContext (targetRepository );
97
98
if (Files .isDirectory (targetRepository .resolve (".git" ))) {
98
99
// checks for remotes
99
- ProcessResult result = this .processContext .addArg ("remote" ).run (true , false );
100
+ ProcessResult result = this .processContext .addArg ("remote" ).run (ProcessMode . DEFAULT_CAPTURE );
100
101
List <String > remotes = result .getOut ();
101
102
if (remotes .isEmpty ()) {
102
103
String message = targetRepository
@@ -183,7 +184,7 @@ public void clone(GitUrl gitRepoUrl, Path targetRepository) {
183
184
this .processContext .addArg ("-q" );
184
185
}
185
186
this .processContext .addArgs ("--recursive" , parsedUrl , "--config" , "core.autocrlf=false" , "." );
186
- result = this .processContext .run (true , false );
187
+ result = this .processContext .run (ProcessMode . DEFAULT_CAPTURE );
187
188
if (!result .isSuccessful ()) {
188
189
this .context .warning ("Git failed to clone {} into {}." , parsedUrl , targetRepository );
189
190
}
@@ -198,7 +199,7 @@ public void pull(Path targetRepository) {
198
199
initializeProcessContext (targetRepository );
199
200
ProcessResult result ;
200
201
// pull from remote
201
- result = this .processContext .addArg ("--no-pager" ).addArg ("pull" ).run (true , false );
202
+ result = this .processContext .addArg ("--no-pager" ).addArg ("pull" ).run (ProcessMode . DEFAULT_CAPTURE );
202
203
203
204
if (!result .isSuccessful ()) {
204
205
Map <String , String > remoteAndBranchName = retrieveRemoteAndBranchName ();
@@ -211,7 +212,7 @@ public void pull(Path targetRepository) {
211
212
private Map <String , String > retrieveRemoteAndBranchName () {
212
213
213
214
Map <String , String > remoteAndBranchName = new HashMap <>();
214
- ProcessResult remoteResult = this .processContext .addArg ("branch" ).addArg ("-vv" ).run (true , false );
215
+ ProcessResult remoteResult = this .processContext .addArg ("branch" ).addArg ("-vv" ).run (ProcessMode . DEFAULT_CAPTURE );
215
216
List <String > remotes = remoteResult .getOut ();
216
217
if (!remotes .isEmpty ()) {
217
218
for (String remote : remotes ) {
@@ -242,14 +243,14 @@ public void reset(Path targetRepository, String remoteName, String branchName) {
242
243
initializeProcessContext (targetRepository );
243
244
ProcessResult result ;
244
245
// check for changed files
245
- result = this .processContext .addArg ("diff-index" ).addArg ("--quiet" ).addArg ("HEAD" ).run (true , false );
246
+ result = this .processContext .addArg ("diff-index" ).addArg ("--quiet" ).addArg ("HEAD" ).run (ProcessMode . DEFAULT_CAPTURE );
246
247
247
248
if (!result .isSuccessful ()) {
248
249
// reset to origin/master
249
250
context .warning ("Git has detected modified files -- attempting to reset {} to '{}/{}'." , targetRepository ,
250
251
remoteName , branchName );
251
- result = this .processContext .addArg ("reset" ).addArg ("--hard" ).addArg (remoteName + "/" + branchName ). run ( true ,
252
- false );
252
+ result = this .processContext .addArg ("reset" ).addArg ("--hard" ).addArg (remoteName + "/" + branchName )
253
+ . run ( ProcessMode . DEFAULT_CAPTURE );
253
254
254
255
if (!result .isSuccessful ()) {
255
256
context .warning ("Git failed to reset {} to '{}/{}'." , remoteName , branchName , targetRepository );
@@ -265,12 +266,12 @@ public void cleanup(Path targetRepository) {
265
266
ProcessResult result ;
266
267
// check for untracked files
267
268
result = this .processContext .addArg ("ls-files" ).addArg ("--other" ).addArg ("--directory" ).addArg ("--exclude-standard" )
268
- .run (true , false );
269
+ .run (ProcessMode . DEFAULT_CAPTURE );
269
270
270
271
if (!result .getOut ().isEmpty ()) {
271
272
// delete untracked files
272
273
context .warning ("Git detected untracked files in {} and is attempting a cleanup." , targetRepository );
273
- result = this .processContext .addArg ("clean" ).addArg ("-df" ).run (true , false );
274
+ result = this .processContext .addArg ("clean" ).addArg ("-df" ).run (ProcessMode . DEFAULT_CAPTURE );
274
275
275
276
if (!result .isSuccessful ()) {
276
277
context .warning ("Git failed to clean the repository {}." , targetRepository );
0 commit comments