mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 05:41:36 +00:00
Fix metadata missing
This commit is contained in:
parent
035f223aef
commit
91137ebf82
1 changed files with 22 additions and 0 deletions
22
benchmark.ts
22
benchmark.ts
|
|
@ -72,6 +72,11 @@ const generateRandomFiles = (
|
|||
maxDepth: number,
|
||||
maxTotalSize: number,
|
||||
) => {
|
||||
const metadata: { lastSync: number; files: { [key: string]: {} } } = {
|
||||
lastSync: 0,
|
||||
files: {},
|
||||
};
|
||||
|
||||
// Create root directory if it doesn't exist
|
||||
if (!fs.existsSync(rootPath)) {
|
||||
fs.mkdirSync(rootPath, { recursive: true });
|
||||
|
|
@ -136,8 +141,25 @@ const generateRandomFiles = (
|
|||
fs.writeFileSync(filePath, content);
|
||||
totalSize += contentSize;
|
||||
}
|
||||
|
||||
const relativeFilePath = filePath.replace(`${rootPath}/`, "");
|
||||
metadata.files[relativeFilePath] = {
|
||||
path: relativeFilePath,
|
||||
sha: null,
|
||||
dirty: true,
|
||||
justDownloaded: false,
|
||||
lastModified: Date.now(),
|
||||
};
|
||||
}
|
||||
|
||||
const metadataFilePath = path.join(
|
||||
rootPath,
|
||||
".obsidian",
|
||||
"github-sync-metadata.json",
|
||||
);
|
||||
fs.mkdirSync(path.join(rootPath, ".obsidian"));
|
||||
fs.writeFileSync(metadataFilePath, JSON.stringify(metadata), { flag: "w" });
|
||||
|
||||
return totalSize;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue