feat(issue-77): handle multiple target branches (#78)

fix: https://github.com/kiegroup/git-backporting/issues/77

This enhancement allow users to backport the same change to multiple
branches with one single tool invocation
This commit is contained in:
Andrea Lamparelli 2023-08-03 21:57:11 +02:00 committed by GitHub
parent c19a56a9ad
commit 5fc72e127b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 1774 additions and 234 deletions

View file

@ -63,9 +63,13 @@ export default class GitCLIService {
this.logger.info(`Cloning repository ${from} to ${to}`);
if (!fs.existsSync(to)) {
await simpleGit().clone(this.remoteWithAuth(from), to, ["--quiet", "--shallow-submodules", "--no-tags", "--branch", branch]);
} else {
this.logger.warn(`Folder ${to} already exist. Won't clone`);
return;
}
this.logger.info(`Folder ${to} already exist. Won't clone`);
// checkout to the proper branch
this.logger.info(`Checking out branch ${branch}`);
await this.git(to).checkout(branch);
}
/**