Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement symbolic links #1184

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 53 additions & 14 deletions packages/backend/src/managers/gitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import { window } from '@podman-desktop/api';
import fs, { statSync, existsSync, mkdirSync, rmSync } from 'node:fs';
import git from 'isomorphic-git';
import { env, window } from '@podman-desktop/api';
import fs, { existsSync, mkdirSync, type NoParamCallback, rmSync, statSync } from 'node:fs';
import git, { type CallbackFsClient } from 'isomorphic-git';
import http from 'isomorphic-git/http/node';

export interface GitCloneInfo {
Expand All @@ -27,11 +27,50 @@
targetDirectory: string;
}

function getFs(): CallbackFsClient {
if (env.isWindows) {

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > cloneRepository > clone and checkout if ref is specified

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ src/managers/gitManager.spec.ts:77:22

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > cloneRepository > clone and checkout if ref is NOT specified

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ src/managers/gitManager.spec.ts:93:22

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > processCheckout > first install no existing folder

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ GitManager.processCheckout src/managers/gitManager.ts:202:16 ❯ src/managers/gitManager.spec.ts:113:28

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > processCheckout > existing folder not-updatable and user reset

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ GitManager.processCheckout src/managers/gitManager.ts:202:16 ❯ src/managers/gitManager.spec.ts:209:5

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > isRepositoryUpToDate > no remote defined

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:252:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid without ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:275:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid with invalid ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:297:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid with expected ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:319:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached with expected ref and modified files

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:343:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached with expected ref and deleted files

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:367:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > cloneRepository > clone and checkout if ref is specified

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ src/managers/gitManager.spec.ts:77:22

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > cloneRepository > clone and checkout if ref is NOT specified

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ src/managers/gitManager.spec.ts:93:22

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > processCheckout > first install no existing folder

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ GitManager.processCheckout src/managers/gitManager.ts:202:16 ❯ src/managers/gitManager.spec.ts:113:28

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > processCheckout > existing folder not-updatable and user reset

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ GitManager.processCheckout src/managers/gitManager.ts:202:16 ❯ src/managers/gitManager.spec.ts:209:5

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > isRepositoryUpToDate > no remote defined

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:252:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid without ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:275:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid with invalid ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:297:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid with expected ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:319:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached with expected ref and modified files

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:343:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached with expected ref and deleted files

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:367:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > cloneRepository > clone and checkout if ref is specified

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ src/managers/gitManager.spec.ts:77:22

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > cloneRepository > clone and checkout if ref is NOT specified

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ src/managers/gitManager.spec.ts:93:22

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > processCheckout > first install no existing folder

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ GitManager.processCheckout src/managers/gitManager.ts:202:16 ❯ src/managers/gitManager.spec.ts:113:28

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > processCheckout > existing folder not-updatable and user reset

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.cloneRepository src/managers/gitManager.ts:73:11 ❯ GitManager.processCheckout src/managers/gitManager.ts:202:16 ❯ src/managers/gitManager.spec.ts:209:5

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > isRepositoryUpToDate > no remote defined

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:252:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid without ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:275:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid with invalid ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:297:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached invalid with expected ref

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:319:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached with expected ref and modified files

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:343:37

Check failure on line 31 in packages/backend/src/managers/gitManager.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

src/managers/gitManager.spec.ts > isRepositoryUpToDate > detached with expected ref and deleted files

Error: [vitest] No "env" export is defined on the "@podman-desktop/api" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@podman-desktop/api", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ getFs src/managers/gitManager.ts:31:7 ❯ GitManager.isRepositoryUpToDate src/managers/gitManager.ts:212:11 ❯ src/managers/gitManager.spec.ts:367:37
return {
chmod: fs.chmod,
lstat: fs.lstat,
mkdir: fs.mkdir,
readFile: fs.readFile,
readdir: fs.readdir,
readlink: fs.readlink,
rmdir: fs.rmdir,
stat: fs.stat,
symlink: (
target: fs.PathLike,
path: fs.PathLike,
type_: fs.symlink.Type | undefined,
callback: fs.NoParamCallback,
) => {
if (!callback) {
callback = type_ as unknown as NoParamCallback;
type_ = undefined;
}
fs.symlink(target, path, type_, err => {
if (err) {
fs.writeFile(path, target.toString(), { mode: 0o0444 }, err => {
callback(err);
});
} else {
// eslint-disable-next-line no-null/no-null
callback(null);
}
});
},
unlink: fs.unlink,
writeFile: fs.writeFile,
};
}
return fs;
}

export class GitManager {
async cloneRepository(gitCloneInfo: GitCloneInfo) {
// clone repo
await git.clone({
fs,
fs: getFs(),
http,
dir: gitCloneInfo.targetDirectory,
url: gitCloneInfo.repository,
Expand Down Expand Up @@ -78,7 +117,7 @@
clean: boolean;
}> {
const status = await git.statusMatrix({
fs,
fs: getFs(),
dir: directory,
});

Expand Down Expand Up @@ -106,12 +145,12 @@
}

async getCurrentCommit(directory: string): Promise<string> {
return git.resolveRef({ fs, dir: directory, ref: 'HEAD' });
return git.resolveRef({ fs: getFs(), dir: directory, ref: 'HEAD' });
}

async pull(directory: string): Promise<void> {
return git.pull({
fs,
fs: getFs(),
http,
dir: directory,
});
Expand Down Expand Up @@ -170,7 +209,7 @@
): Promise<{ ok?: boolean; updatable?: boolean; error?: string }> {
// fetch updates
await git.fetch({
fs,
fs: getFs(),
http,
dir: directory,
});
Expand All @@ -186,7 +225,7 @@
}

const branch = await git.currentBranch({
fs,
fs: getFs(),
dir: directory,
});

Expand Down Expand Up @@ -240,12 +279,12 @@

async getTrackingBranch(directory: string, branch: string): Promise<string | undefined> {
const mergeRef = await git.getConfig({
fs,
fs: getFs(),
dir: directory,
path: `branch.${branch}.merge`,
});
const remote = await git.getConfig({
fs,
fs: getFs(),
dir: directory,
path: `branch.${branch}.remote`,
});
Expand All @@ -257,7 +296,7 @@

const remoteCommits = (
await git.log({
fs,
fs: getFs(),
dir,
ref: remoteBranch,
})
Expand All @@ -266,7 +305,7 @@
.sort();
const localCommits = (
await git.log({
fs,
fs: getFs(),
dir,
ref: localBranch,
})
Expand Down Expand Up @@ -302,7 +341,7 @@
async getTagCommitId(directory: string, tagName: string): Promise<string | undefined> {
try {
return await git.resolveRef({
fs,
fs: getFs(),
dir: directory,
ref: tagName,
});
Expand Down