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,
|
private void sign(CommitBuilder commit) throws ServiceUnavailableException,
|
||||||
CanceledException, UnsupportedSigningFormatException {
|
CanceledException, UnsupportedSigningFormatException {
|
||||||
if (gpgSigner == null) {
|
if (gpgSigner == null) {
|
||||||
throw new ServiceUnavailableException(
|
gpgSigner = GpgSigner.getDefault();
|
||||||
JGitText.get().signingServiceUnavailable);
|
if (gpgSigner == null) {
|
||||||
|
throw new ServiceUnavailableException(
|
||||||
|
JGitText.get().signingServiceUnavailable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (signingKey == null) {
|
||||||
|
signingKey = gpgConfig.getSigningKey();
|
||||||
}
|
}
|
||||||
if (gpgSigner instanceof GpgObjectSigner) {
|
if (gpgSigner instanceof GpgObjectSigner) {
|
||||||
((GpgObjectSigner) gpgSigner).signObject(commit,
|
((GpgObjectSigner) gpgSigner).signObject(commit,
|
||||||
|
@ -659,12 +665,6 @@ private void processOptions(RepositoryState state, RevWalk rw)
|
||||||
signCommit = gpgConfig.isSignCommits() ? Boolean.TRUE
|
signCommit = gpgConfig.isSignCommits() ? Boolean.TRUE
|
||||||
: Boolean.FALSE;
|
: Boolean.FALSE;
|
||||||
}
|
}
|
||||||
if (signingKey == null) {
|
|
||||||
signingKey = gpgConfig.getSigningKey();
|
|
||||||
}
|
|
||||||
if (gpgSigner == null) {
|
|
||||||
gpgSigner = GpgSigner.getDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMergeDuringRebase(RepositoryState state) {
|
private boolean isMergeDuringRebase(RepositoryState state) {
|
||||||
|
|
Loading…
Reference in New Issue