diff --git a/lib/backmerge.ts b/lib/backmerge.ts index 8a13fc5..99ae017 100644 --- a/lib/backmerge.ts +++ b/lib/backmerge.ts @@ -46,7 +46,10 @@ export const getBranches = async (context: Context, config: BackmergeConfig) => context.logger.log(`Current branch '${releaseBranch}' matches following configured backmerge targets: '${JSON.stringify(appropriates)}'. Performing backmerge.`) const git = new Git(context.cwd, context.env) - await git.fetchAllRemotes() + + // ensure at any time and any moment that the fetch'ed remote url is the same as there + // https://github.com/semantic-release/git/blob/master/lib/prepare.js#L69 + // it's to ensure that the commit done during @semantic-release/git is backmerged alongside the other commits await git.fetch(config.repositoryUrl) const branches = (await git.ls(config.repositoryUrl)). @@ -114,8 +117,13 @@ export const executeBackmerge = async (context: Context, config: BackmergeConfig const authRemote = authModificator(url, config.platform, config.token) const git = new Git(context.cwd, context.env) - // await git.fetchAllRemotes() + + // ensure at any time and any moment that the fetch'ed remote url is the same as there + // https://github.com/semantic-release/git/blob/master/lib/prepare.js#L69 + // it's to ensure that the commit done during @semantic-release/git is backmerged alongside the other commits await git.fetch(config.repositoryUrl) + + // checkout to ensure released branch is up to date with last fetch'ed remote url await git.checkout(releaseBranch) const commit = template(config.commit) diff --git a/lib/git.ts b/lib/git.ts index 3358d42..f225c0e 100644 --- a/lib/git.ts +++ b/lib/git.ts @@ -77,13 +77,6 @@ export class Git { await this.exec(["fetch", remote]) } - /** - * @see https://github.com/saitho/semantic-release-backmerge/blob/master/src/helpers/git.ts#L122 - */ - public async fetchAllRemotes() { - await this.exec(["config", "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*"]) - } - /** * merge executes a checkout of input 'to' branch, and merges input 'from' branch into 'to'. * If a merge commit must be done (by default --ff is used), then the merge commit is the input commit.