mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
f31dacb8cd
Fixes #18805
35 lines
991 B
TypeScript
35 lines
991 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type { SimpleGitOptions } from 'simple-git';
|
|
import { GlobalConfig } from '../../config/global';
|
|
import type { GitNoVerifyOption } from './types';
|
|
|
|
let noVerify: GitNoVerifyOption[] = ['push', 'commit'];
|
|
|
|
export function setNoVerify(value: GitNoVerifyOption[]): void {
|
|
// istanbul ignore if
|
|
if (!is.array(value, is.string)) {
|
|
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'],
|
|
};
|
|
// https://github.com/steveukx/git-js/pull/591
|
|
const gitTimeout = GlobalConfig.get('gitTimeout');
|
|
if (is.number(gitTimeout) && gitTimeout > 0) {
|
|
config.timeout = { block: gitTimeout };
|
|
}
|
|
return config;
|
|
}
|