fix: --no-squash on single-commit GitLab MR (#93)

Due to off-by-one error in GitLabMapper, --no-squash was not effective
on an MR containing single commit. Fix by using the same condition as
GitHubMapper.
This commit is contained in:
Ratchanan Srirattanamet 2024-02-20 20:24:08 +07:00 committed by GitHub
parent b7df1f80dc
commit 300fa91a8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 376 additions and 165 deletions

View file

@ -41,8 +41,8 @@ export default class GitLabMapper implements GitResponseMapper<MergeRequestSchem
sourceRepo: await this.mapSourceRepo(mr),
targetRepo: await this.mapTargetRepo(mr),
// if commits list is provided use that as source
nCommits: (commits && commits.length > 1) ? commits.length : 1,
commits: (commits && commits.length > 1) ? commits : this.getSha(mr)
nCommits: (commits && commits.length > 0) ? commits.length : 1,
commits: (commits && commits.length > 0) ? commits : this.getSha(mr)
};
}