-
Notifications
You must be signed in to change notification settings - Fork 3k
Expand file tree
/
Copy pathconfig.ts
More file actions
39 lines (35 loc) · 1.12 KB
/
config.ts
File metadata and controls
39 lines (35 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { isArray, isNumber, isString } from '@sindresorhus/is';
import type { SimpleGitOptions } from 'simple-git';
import { GlobalConfig } from '../../config/global.ts';
import { getEnv } from '../env.ts';
import type { GitNoVerifyOption } from './types.ts';
let noVerify: GitNoVerifyOption[] = ['push', 'commit'];
export function setNoVerify(value: GitNoVerifyOption[]): void {
if (!isArray(value, isString)) {
throw new Error('config error: gitNoVerify should be an array of strings');
}
noVerify = value;
}
export function getNoVerify(): GitNoVerifyOption[] {
return noVerify;
}
export function simpleGitConfig(): Partial<SimpleGitOptions> {
const config: Partial<SimpleGitOptions> = {
completion: {
onClose: true,
onExit: false,
},
config: ['core.quotePath=false'],
};
if (getEnv().RENOVATE_X_CLEAR_HOOKS) {
config.unsafe = {
allowUnsafeHooksPath: true,
};
}
// https://github.com/steveukx/git-js/pull/591
const gitTimeout = GlobalConfig.get('gitTimeout');
if (isNumber(gitTimeout) && gitTimeout > 0) {
config.timeout = { block: gitTimeout };
}
return config;
}