Skip to content

Commit

Permalink
fix(revert): reverts "fix: fetch repository with URL (#12)"
Browse files Browse the repository at this point in the history
This reverts commit 2efae25 as that broke everything.
  • Loading branch information
saitho committed Apr 12, 2021
1 parent 71f6fc7 commit 5471dc3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/helpers/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/perform-backmerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function performBackmerge(git: Git, pluginConfig: Partial<Config>,
await git.configFetchAllRemotes();

// Get latest commits before checking out
await git.fetch(context.options.repositoryUrl);
await git.fetch();

if (options.clearWorkspace) {
context.logger.log(
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
32 changes: 16 additions & 16 deletions test/perform-backmerge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -146,7 +146,7 @@ describe("perform-backmerge", () => {
when(mockedGit.configFetchAllRemotes()).thenResolve();
when(mockedGit.getStagedFiles())
.thenReturn(new Promise<string[]>(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();
Expand All @@ -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();
Expand All @@ -178,7 +178,7 @@ describe("perform-backmerge", () => {
when(mockedGit.configFetchAllRemotes()).thenResolve();
when(mockedGit.getStagedFiles())
.thenReturn(new Promise<string[]>(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();
Expand All @@ -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);
Expand All @@ -216,7 +216,7 @@ describe("perform-backmerge", () => {
when(mockedGit.configFetchAllRemotes()).thenResolve();
when(mockedGit.getStagedFiles())
.thenReturn(new Promise<string[]>(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();
Expand All @@ -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();
Expand Down

0 comments on commit 5471dc3

Please sign in to comment.