Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
yy4382 committed May 19, 2024
1 parent 897001c commit c081c9e
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions src/Upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,40 @@ export default class Uploader {
NOT_UP_TO_DATE,
UP_TO_DATE,
}

// try {
// await fs.promises.mkdir(dir, undefined);
// } catch (e) {
// // console.error(e);
// new Notice("Error while creating directory");
// return;
// }
// console.log(await fs.promises.readdir(dir));
let repoStat: RepoStat | undefined = undefined;

await git.clone({
fs,
http,
dir,
corsProxy: 'https://cors.isomorphic-git.org',
url: 'https://github.com/isomorphic-git/isomorphic-git',
ref: 'main',
singleBranch: true,
depth: 1,
});
console.log(await fs.promises.readdir(dir));

new Notice("Start uploading to git, try using locally cached repo...");
// Check if the repo is already cloned and up to date
let localSha = "";
try {
localSha = await git.resolveRef({
fs,
dir: dir,
ref: "refs/heads/" + config.branch,
});
} catch {
repoStat = RepoStat.NOT_EXIST;
}
// let localSha = "";
// try {
// localSha = await git.resolveRef({
// fs,
// dir: dir,
// ref: "refs/heads/" + config.branch,
// });
// } catch {
// repoStat = RepoStat.NOT_EXIST;
// }

// if (repoStat === undefined) {
// // repo already exists. Check if the remote is up to date
Expand Down

0 comments on commit c081c9e

Please sign in to comment.