CommitCommand: call GpgSigner.getDefault() only if indeed signing
If we're not signing the commit, we don't need the GpgSigner at all. Change-Id: Ica35651c73d82b7604c8a67487b0d9474c908aae Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
parent
fbce3122e0
commit
7e06e51750
|
@ -323,8 +323,14 @@ private void checkIfEmpty(RevWalk rw, ObjectId headId, ObjectId indexTreeId)
|
|||
private void sign(CommitBuilder commit) throws ServiceUnavailableException,
|
||||
CanceledException, UnsupportedSigningFormatException {
|
||||
if (gpgSigner == null) {
|
||||
throw new ServiceUnavailableException(
|
||||
JGitText.get().signingServiceUnavailable);
|
||||
gpgSigner = GpgSigner.getDefault();
|
||||
if (gpgSigner == null) {
|
||||
throw new ServiceUnavailableException(
|
||||
JGitText.get().signingServiceUnavailable);
|
||||
}
|
||||
}
|
||||
if (signingKey == null) {
|
||||
signingKey = gpgConfig.getSigningKey();
|
||||
}
|
||||
if (gpgSigner instanceof GpgObjectSigner) {
|
||||
((GpgObjectSigner) gpgSigner).signObject(commit,
|
||||
|
@ -659,12 +665,6 @@ private void processOptions(RepositoryState state, RevWalk rw)
|
|||
signCommit = gpgConfig.isSignCommits() ? Boolean.TRUE
|
||||
: Boolean.FALSE;
|
||||
}
|
||||
if (signingKey == null) {
|
||||
signingKey = gpgConfig.getSigningKey();
|
||||
}
|
||||
if (gpgSigner == null) {
|
||||
gpgSigner = GpgSigner.getDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMergeDuringRebase(RepositoryState state) {
|
||||
|
|
Loading…
Reference in New Issue