feat: add --cherry-pick-options to add to all cherry-pick run

Fixes: https://github.com/kiegroup/git-backporting/issues/111
This commit is contained in:
Earl Warren 2024-04-01 22:39:06 +02:00
parent 53cc505f17
commit 14372405ce
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
18 changed files with 179 additions and 81 deletions

View file

@ -110,10 +110,15 @@ export default class GitCLIService {
* @param cwd repository in which the sha should be cherry picked to
* @param sha commit sha
*/
async cherryPick(cwd: string, sha: string, strategy = "recursive", strategyOption = "theirs"): Promise<void> {
async cherryPick(cwd: string, sha: string, strategy = "recursive", strategyOption = "theirs", cherryPickOptions: string | undefined): Promise<void> {
this.logger.info(`Cherry picking ${sha}`);
const options = ["cherry-pick", "-m", "1", `--strategy=${strategy}`, `--strategy-option=${strategyOption}`, sha];
let options = ["cherry-pick", "-m", "1", `--strategy=${strategy}`, `--strategy-option=${strategyOption}`];
if (cherryPickOptions !== undefined) {
options = options.concat(cherryPickOptions.split(" "));
}
options.push(sha);
this.logger.debug(`Cherry picking command git ${options}`);
try {
await this.git(cwd).raw(options);
} catch(error) {