Compare commits
No commits in common. "42c389b9133af1001dfeb09ba776c0985595b45b" and "ab6c56e55a8c942df3faab9249c9523c6cf6d560" have entirely different histories.
42c389b913
...
ab6c56e55a
3
.gitignore
vendored
3
.gitignore
vendored
@ -33,4 +33,5 @@ lerna-debug.log*
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
/config.yml
|
||||
workspaces/*
|
||||
!workspaces/.gitkeep
|
@ -12,7 +12,7 @@ describe('ReposResolver', () => {
|
||||
resolver = module.get<ReposResolver>(ReposResolver);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
it('should be defined', () => {
|
||||
expect(resolver).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
@ -3,10 +3,10 @@ import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Project } from '../projects/project.entity';
|
||||
import { ReposService } from './repos.service';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { rm } from 'fs/promises';
|
||||
import { rm, unlink } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
|
||||
const workspacesRoot = 'E:\\Projects\\demos\\workspaces';
|
||||
const workspacesRoot = '/Users/ivanli/Projects/fennec/workspaces';
|
||||
|
||||
describe('ReposService', () => {
|
||||
let service: ReposService;
|
||||
@ -21,15 +21,7 @@ describe('ReposService', () => {
|
||||
}),
|
||||
),
|
||||
}));
|
||||
afterEach(async () => {
|
||||
await rm(join(workspacesRoot, 'test1'), {
|
||||
recursive: true,
|
||||
}).catch(() => undefined);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await rm(join(workspacesRoot, 'test1'), {
|
||||
recursive: true,
|
||||
}).catch(() => undefined);
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [
|
||||
ReposService,
|
||||
@ -55,6 +47,9 @@ describe('ReposService', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
describe('listLogs', () => {
|
||||
beforeEach(async () => {
|
||||
await rm(join(workspacesRoot, 'test1'), { recursive: true });
|
||||
});
|
||||
it('should be return logs', async () => {
|
||||
const result = await service.listLogs({ projectId: '1' });
|
||||
expect(result).toBeDefined();
|
||||
|
@ -34,6 +34,7 @@ export class ReposService {
|
||||
if (firstInit) {
|
||||
await git.init();
|
||||
await git.addRemote('origin', project.sshUrl);
|
||||
// await git.clone(project.sshUrl, workspacePath);
|
||||
}
|
||||
return git;
|
||||
}
|
||||
@ -43,7 +44,13 @@ export class ReposService {
|
||||
id: dto.projectId,
|
||||
});
|
||||
const git = await this.getGit(project);
|
||||
await git.fetch();
|
||||
await git
|
||||
.outputHandler((command, stdout, stderr) => {
|
||||
stdout.pipe(process.stdout);
|
||||
stderr.pipe(process.stderr);
|
||||
})
|
||||
.fetch();
|
||||
// await git.checkoutBranch('master', 'origin/master');
|
||||
return await git.log({
|
||||
'--branches': dto.branch ?? '',
|
||||
'--remotes': 'origin',
|
||||
|
Loading…
Reference in New Issue
Block a user