mirror of
https://github.com/desktop/desktop
synced 2024-10-31 05:19:03 +00:00
Don't assign gpgSignEnabled more than once
This commit is contained in:
parent
4bd49263e7
commit
6276830343
1 changed files with 6 additions and 11 deletions
|
@ -71,7 +71,7 @@ export async function parseRepoRules(
|
||||||
repository: Repository
|
repository: Repository
|
||||||
): Promise<RepoRulesInfo> {
|
): Promise<RepoRulesInfo> {
|
||||||
const info = new RepoRulesInfo()
|
const info = new RepoRulesInfo()
|
||||||
let gitConfigKeySet: boolean | null = null
|
let gpgSignEnabled: boolean | undefined = undefined
|
||||||
|
|
||||||
for (const rule of rules) {
|
for (const rule of rules) {
|
||||||
// if a ruleset is null/undefined, then act as if the rule doesn't exist because
|
// if a ruleset is null/undefined, then act as if the rule doesn't exist because
|
||||||
|
@ -102,17 +102,12 @@ export async function parseRepoRules(
|
||||||
break
|
break
|
||||||
|
|
||||||
case APIRepoRuleType.RequiredSignatures:
|
case APIRepoRuleType.RequiredSignatures:
|
||||||
// check if the user has commit signing configured. if they do, the rule passes
|
// check if the user has commit signing configured. if they do, the rule
|
||||||
// and doesn't need to be warned about.
|
// passes and doesn't need to be warned about.
|
||||||
if (gitConfigKeySet === null) {
|
gpgSignEnabled ??=
|
||||||
gitConfigKeySet = await getBooleanConfigValue(
|
(await getBooleanConfigValue(repository, 'commit.gpgsign')) ?? false
|
||||||
repository,
|
|
||||||
'commit.gpgsign',
|
|
||||||
false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gitConfigKeySet !== true) {
|
if (gpgSignEnabled !== true) {
|
||||||
info.signedCommitsRequired =
|
info.signedCommitsRequired =
|
||||||
info.signedCommitsRequired !== true ? enforced : true
|
info.signedCommitsRequired !== true ? enforced : true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue