fix(transformer): find last modified date form commit on submodule

when the content folder has a submodule git, the relative path start in content folder and not root folder of quartz
This commit is contained in:
dralagen 2025-03-13 15:17:13 +01:00 committed by GitHub
parent c005fe4408
commit 88d8d89171
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,11 +56,13 @@ export const CreatedModifiedDate: QuartzTransformerPlugin<Partial<Options>> = (u
// Get a reference to the main git repo. // Get a reference to the main git repo.
// It's either the same as the workdir, // It's either the same as the workdir,
// or 1+ level higher in case of a submodule/subtree setup // or 1+ level higher in case of a submodule/subtree setup
repo = Repository.discover(file.cwd) repo = Repository.discover(fullFp)
} }
var relativePath = fullFp.replace(repo.workdir()!, "")
try { try {
modified ||= await repo.getFileLatestModifiedDateAsync(file.data.filePath!) modified ||= await repo.getFileLatestModifiedDateAsync(relativePath)
} catch { } catch {
console.log( console.log(
chalk.yellow( chalk.yellow(