From 5471dc39faf7fcdd9c3f3780b75ad2e2fb128a22 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Mon, 12 Apr 2021 19:29:35 +0200 Subject: [PATCH] fix(revert): reverts "fix: fetch repository with URL (#12)" This reverts commit 2efae257 as that broke everything. --- src/helpers/git.ts | 4 ++-- src/perform-backmerge.ts | 2 +- test/helpers/git.test.ts | 4 ++-- test/perform-backmerge.test.ts | 32 ++++++++++++++++---------------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/helpers/git.ts b/src/helpers/git.ts index 7365b45..2b2486a 100644 --- a/src/helpers/git.ts +++ b/src/helpers/git.ts @@ -77,8 +77,8 @@ export default class Git { * * @throws {Error} if the fetch failed. */ - async fetch(repositoryUrl: string) { - await execa('git', ['fetch', repositoryUrl], this.execaOpts); + async fetch() { + await execa('git', ['fetch'], this.execaOpts); } /** diff --git a/src/perform-backmerge.ts b/src/perform-backmerge.ts index 07a0d81..16b565d 100644 --- a/src/perform-backmerge.ts +++ b/src/perform-backmerge.ts @@ -31,7 +31,7 @@ export async function performBackmerge(git: Git, pluginConfig: Partial, await git.configFetchAllRemotes(); // Get latest commits before checking out - await git.fetch(context.options.repositoryUrl); + await git.fetch(); if (options.clearWorkspace) { context.logger.log( diff --git a/test/helpers/git.test.ts b/test/helpers/git.test.ts index d468fa7..c29ba5d 100644 --- a/test/helpers/git.test.ts +++ b/test/helpers/git.test.ts @@ -55,8 +55,8 @@ describe("git", () => { }); it("fetch", async () => { - await subject.fetch('my-repo'); - expect(execa).toHaveBeenCalledWith('git', ['fetch', 'my-repo'], expect.objectContaining(execaOpts)); + await subject.fetch(); + expect(execa).toHaveBeenCalledWith('git', ['fetch'], expect.objectContaining(execaOpts)); }); it("configFetchAllRemotes", async () => { diff --git a/test/perform-backmerge.test.ts b/test/perform-backmerge.test.ts index c2d295d..fcb2d48 100644 --- a/test/perform-backmerge.test.ts +++ b/test/perform-backmerge.test.ts @@ -14,7 +14,7 @@ describe("perform-backmerge", () => { when(mockedGit.checkout(anyString())).thenResolve(); when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()).thenResolve([]); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -24,7 +24,7 @@ describe("perform-backmerge", () => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "develop".')).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('develop')).once(); verify(mockedGit.rebase('master')).once(); verify(mockedGit.push('my-repo', 'develop', false)).once(); @@ -39,7 +39,7 @@ describe("perform-backmerge", () => { when(mockedGit.checkout(anyString())).thenResolve(); when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()).thenResolve([]); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -48,7 +48,7 @@ describe("perform-backmerge", () => { .then(() => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "master".')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.rebase('master')).never(); verify(mockedGit.push('my-repo', 'master', false)).once(); @@ -71,7 +71,7 @@ describe("perform-backmerge", () => { when(mockedGit.checkout(anyString())).thenResolve(); when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()).thenResolve([]); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -80,7 +80,7 @@ describe("perform-backmerge", () => { .then(() => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "master".')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.rebase('master')).never(); verify(mockedGit.push('my-repo', 'master', false)).once(); @@ -95,7 +95,7 @@ describe("perform-backmerge", () => { when(mockedGit.checkout(anyString())).thenResolve(); when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()).thenResolve([]); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -105,7 +105,7 @@ describe("perform-backmerge", () => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "develop".')).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('develop')).once(); verify(mockedGit.rebase('master')).once(); verify(mockedGit.push('my-repo', 'develop', false)).once(); @@ -120,7 +120,7 @@ describe("perform-backmerge", () => { when(mockedGit.checkout(anyString())).thenResolve(); when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()).thenResolve([]); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -130,7 +130,7 @@ describe("perform-backmerge", () => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "develop".')).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('develop')).once(); verify(mockedGit.rebase('master')).once(); verify(mockedGit.push('my-repo', 'develop', true)).once(); @@ -146,7 +146,7 @@ describe("perform-backmerge", () => { when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()) .thenReturn(new Promise(resolve => resolve(['A file-changed-by-plugin.md']))); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.commit(anyString())).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -164,7 +164,7 @@ describe("perform-backmerge", () => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "develop".')).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('develop')).once(); verify(mockedGit.rebase('master')).once(); verify(mockedGit.commit('my-commit-message')).once(); @@ -178,7 +178,7 @@ describe("perform-backmerge", () => { when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()) .thenReturn(new Promise(resolve => resolve([]))); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.commit(anyString())).thenResolve(); when(mockedGit.rebase(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -197,7 +197,7 @@ describe("perform-backmerge", () => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "develop".')).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); const checkoutDevelopAction = mockedGit.checkout('develop'); verify(mockedGit.stash()).calledBefore(checkoutDevelopAction); @@ -216,7 +216,7 @@ describe("perform-backmerge", () => { when(mockedGit.configFetchAllRemotes()).thenResolve(); when(mockedGit.getStagedFiles()) .thenReturn(new Promise(resolve => resolve([]))); - when(mockedGit.fetch(anyString())).thenResolve(); + when(mockedGit.fetch()).thenResolve(); when(mockedGit.commit(anyString())).thenResolve(); when(mockedGit.merge(anyString())).thenResolve(); when(mockedGit.push(anyString(), anyString(), anything())).thenResolve(); @@ -234,7 +234,7 @@ describe("perform-backmerge", () => { verify(mockedLogger.log('Release succeeded. Performing back-merge into branch "develop".')).once(); verify(mockedGit.checkout('master')).once(); verify(mockedGit.configFetchAllRemotes()).once(); - verify(mockedGit.fetch('my-repo')).once(); + verify(mockedGit.fetch()).once(); verify(mockedGit.checkout('develop')).once(); verify(mockedGit.merge('master')).once();