fix(repos): 完善 commit log 订阅接口。

This commit is contained in:
Ivan Li
2021-03-09 22:50:26 +08:00
parent 22d3dc299c
commit d02cea2115
5 changed files with 17 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ export class ReposService {
await mkdir(workspaceRoot, { recursive: true });
});
const git = gitP(workspaceRoot);
if (!(await git.checkIsRepo())) {
if (!(await git.checkIsRepo().catch(() => false))) {
await git.init();
await git.addRemote(DEFAULT_REMOTE_NAME, project.sshUrl);
}
@@ -50,7 +50,9 @@ export class ReposService {
async listLogs({ project, branch }: ListLogsOption) {
const git = await this.getGit(project);
return await git.log(branch ? ['--branches', branch, '--'] : ['--all']);
return await git.log(
branch ? ['--branches', `remotes/origin/${branch}`, '--'] : ['--all'],
);
}
async listBranches(dto: ListBranchesArgs) {