Skip to content

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

Closed
wants to merge 6 commits into from
Closed

fix: use commit time for cache #312

wants to merge 6 commits into from

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Oct 9, 2024

mtime is unreliable between systems / reruns

closes #307

(I haven't tested this out yet)

mtime is unreliable between systems / reruns

closes #307
Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
omnisite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 10:20pm

@dummdidumm
Copy link
Member Author

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(),
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Untested.)

Suggested change
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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { execSync } from 'node:child_process';
import { execFileSync } from 'node:child_process';

@Rich-Harris
Copy link
Member

merged #315, closing

@dummdidumm dummdidumm deleted the use-commit-time branch October 10, 2024 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Speed up build
3 participants