Skip to content

Commit

Permalink
Implemented review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-Eichhorn committed Aug 16, 2021
1 parent 382b282 commit 98e16bf
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private RemoteRefUpdate.Status push(Branch localBranch, RemoteRepositorySettings
.setRemote(targetRepository.getRemoteName())
.setRefSpecs(refSpec)
.setForce(useForcePush);
authenticate(pushCommand, targetRepository);
authenticateCommand(pushCommand, targetRepository);

Iterable<PushResult> pushResults = pushCommand.call();
PushResult pushResult = pushResults.iterator().next();
Expand Down Expand Up @@ -163,7 +163,7 @@ public void fetchSourceBranch(RemoteRepositorySettings sourceRepository) throws
.getRemoteName());

LsRemoteCommand lsRemoteCommand = git.lsRemote().setRemote(sourceRepository.getRemoteName());
authenticate(lsRemoteCommand, sourceRepository);
authenticateCommand(lsRemoteCommand, sourceRepository);

Collection<Ref> refs = lsRemoteCommand.call();

Expand All @@ -179,7 +179,7 @@ public void fetchSourceBranch(RemoteRepositorySettings sourceRepository) throws
FetchCommand fetchCommand = git.fetch()
.setRemote(sourceRepository.getRemoteName())
.setRefSpecs("refs/heads/" + sourceRepository.getBranchName() + ":refs/heads/" + sourceRepository.getBranchName());
authenticate(fetchCommand, sourceRepository);
authenticateCommand(fetchCommand, sourceRepository);

FetchResult fetchResult = fetchCommand.call();

Expand Down Expand Up @@ -237,12 +237,12 @@ protected void configure(OpenSshConfig.Host hc, Session session) {
}

/**
* Decides what type of authentication is performed.
* Authenticates the given command with a password or PPK authentication, depending on the given remote repository setting.
*
* @param command the command to authenticate
* @param remoteRepository the settings for the repository
*/
private void authenticate(TransportCommand<?, ?> command, RemoteRepositorySettings remoteRepository) {
private void authenticateCommand(TransportCommand<?, ?> command, RemoteRepositorySettings remoteRepository) {
if (remoteRepository.getAuthenticationType() == AuthenticationType.PASSWORD) {
authenticatePassword(command, remoteRepository);
} else if (remoteRepository.getAuthenticationType() == AuthenticationType.PPK) {
Expand Down

0 comments on commit 98e16bf

Please sign in to comment.