-
-
Notifications
You must be signed in to change notification settings - Fork 159
fix: use commit time for cache #312
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
Conversation
mtime is unreliable between systems / reruns closes #307
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
mhm so this doesn't seem to work because the commit time doesn't seem to change. Not sure what I did wrong - will continue investigating tomorrow if noone beats me to it. |
} | ||
|
||
return mtime; | ||
const file_commit_time = parseInt( | ||
execSync(`git log -n 1 --pretty=format:%ct -- ${file}`).toString().trim(), |
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.
This should use execFileSync
instead so we can pass an array of args and don't need to worry about escaping things for the shell.
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.
(Untested.)
execSync(`git log -n 1 --pretty=format:%ct -- ${file}`).toString().trim(), | |
execFileSync('git', ['log', '-n', '1', '--pretty=format:%ct', '--', file]).toString().trim(), |
@@ -9,6 +9,7 @@ import { transformerTwoslash } from '@shikijs/twoslash'; | |||
import { SHIKI_LANGUAGE_MAP, escape, normalizeSlugify, smart_quotes, transform } from './utils'; | |||
import type { Modules } from './index'; | |||
import { fileURLToPath } from 'node:url'; | |||
import { execSync } from 'node:child_process'; |
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.
import { execSync } from 'node:child_process'; | |
import { execFileSync } from 'node:child_process'; |
merged #315, closing |
mtime is unreliable between systems / reruns
closes #307
(I haven't tested this out yet)