Skip to content

Commit

Permalink
refactor: "pushed down" a local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
KaziNizamul committed Nov 21, 2023
1 parent 7006e1e commit 07b81d2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/main/java/io/github/jhipster/online/service/GitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ public void pushNewApplicationToGit(User user, File workingDir, String organizat
commit(git, workingDir, "Initial application generation by JHipster");

log.debug("Adding remote repository {} / {}", organization, applicationName);
URIish urIish = null;

RemoteAddCommand remoteAddCommand = git.remoteAdd();
remoteAddCommand.setName("origin");

if (gitProvider.equals(GitProvider.GITHUB)) {
urIish = new URIish(applicationProperties.getGithub().getHost() + "/" + organization + "/" + applicationName + ".git");
URIish urIish = new URIish(applicationProperties.getGithub().getHost() + "/" + organization + "/" + applicationName + ".git");
remoteAddCommand.setUri(urIish);
} else if (gitProvider.equals(GitProvider.GITLAB)) {
urIish =
new URIish(applicationProperties.getGitlab().getHost() + "/" + organization + "/" + applicationName + ".git")
URIish urIish = new URIish(applicationProperties.getGitlab().getHost() + "/" + organization + "/" + applicationName + ".git")
.setPass(user.getGitlabOAuthToken());
remoteAddCommand.setUri(urIish);
}
RemoteAddCommand remoteAddCommand = git.remoteAdd();
remoteAddCommand.setName("origin");
remoteAddCommand.setUri(urIish);
remoteAddCommand.call();

String currentBranch = git.getRepository().getFullBranch();
Expand Down Expand Up @@ -161,4 +162,4 @@ private CredentialsProvider getCredentialProvider(User user, GitProvider gitProv
}
return null;
}
}
}

0 comments on commit 07b81d2

Please sign in to comment.