-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(transformer): find last modified date form commit on submodule #1831
Conversation
when the content folder has a submodule git, the relative path start in content folder and not root folder of quartz
…t modified date calculation
can you see if 771110a works for you locally first? |
I need to calculate the relative path from the repository. if don't do modification, I have this result :
|
@@ -61,8 +62,9 @@ export const CreatedModifiedDate: QuartzTransformerPlugin<Partial<Options>> = (u | |||
modified ||= file.data.frontmatter.modified as MaybeDate | |||
published ||= file.data.frontmatter.published as MaybeDate | |||
} else if (source === "git" && repo) { | |||
const relativePath = path.relative(repo.workdir()!, fullFp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculate workdir where we assign repo and also add an error for when workdir is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workdir return undefined if repository is bare. I thinks, we have other problem on build, like don't find index.md.
calculate workdir where we assign repo
You want to set the value of repo.workdir()
to variable ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes because path.relative(undefined, fullFp)
will cause problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks for review.
use default value if repo.workdir is undefined to user fullFp value
if (opts.priority.includes("git")) { | ||
try { | ||
repo = Repository.discover(ctx.argv.directory) | ||
repositoryWorkdir = repo.workdir() ?? "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repositoryWorkdir = repo.workdir() ?? "" | |
repositoryWorkdir = repo.workdir() ?? ctx.argv.directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use ctx.argv.directory
as default value, because the major usage is the root folder is the workdir of repository and ctx.argc.directory
is valued to content
.
I want to set a default value to make path.relative(repositoryWorkdir, fullFp)
equals to fullFp
when the content folder has a submodule git, the relative path start in content folder and not root folder of quartz
example of repo use a submodule : https://github.com/dralagen/notes.dralagen.fr
The submodule is private to publish only public note and keep some private or draft not visible.