mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-06-13 02:47:49 +02:00
wip handle empty repo
This commit is contained in:
@@ -92,7 +92,8 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
|
|||||||
recursive: "1",
|
recursive: "1",
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.status == 409 && error.message == "Git Repository is empty.") {
|
console.log(error, error.status);
|
||||||
|
if (error.status == 409) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
await this.repository.resetSate("error", "repo_not_accessible");
|
await this.repository.resetSate("error", "repo_not_accessible");
|
||||||
@@ -124,6 +125,7 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
|
|||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: await this.getToken(),
|
auth: await this.getToken(),
|
||||||
});
|
});
|
||||||
|
try {
|
||||||
const ghRes = await octokit.git.getTree({
|
const ghRes = await octokit.git.getTree({
|
||||||
owner: this.githubRepository.owner,
|
owner: this.githubRepository.owner,
|
||||||
repo: this.githubRepository.repo,
|
repo: this.githubRepository.repo,
|
||||||
@@ -151,6 +153,12 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
|
|||||||
}
|
}
|
||||||
this.tree2Tree(ghRes.data.tree, truncatedTree, parentPath);
|
this.tree2Tree(ghRes.data.tree, truncatedTree, parentPath);
|
||||||
return truncatedTree;
|
return truncatedTree;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error, error.status);
|
||||||
|
if (error.status == 409) {
|
||||||
|
}
|
||||||
|
return truncatedTree;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private tree2Tree(
|
private tree2Tree(
|
||||||
|
|||||||
Reference in New Issue
Block a user