in src/desktop/gitlab/clone/gitlab_remote_source.ts [202:231]
async publishRepository(repository: Repository): Promise<void> {
if (repository.state.HEAD?.type !== RefType.Head || !isEmpty(repository.state.mergeChanges)) {
await vscode.window.showErrorMessage(
'The repository seems to be in a detached HEAD state. Please check out a branch.',
);
return;
}
if (
!repository.state.HEAD?.commit &&
isEmpty(repository.state.indexChanges) &&
isEmpty(repository.state.workingTreeChanges)
) {
await vscode.window.showErrorMessage(
'Workspace is empty. To push to GitLab, first add a file to the folder.',
);
return;
}
await this.#publishToNewProject(repository.rootUri, async () => {
if (!repository.state.HEAD?.commit) {
if (isEmpty(repository.state.indexChanges)) {
await repository.commit(DEFAULT_COMMIT_MESSAGE, { all: true });
} else {
await repository.commit(DEFAULT_COMMIT_MESSAGE);
}
}
return repository;
});
}