Skip to content

Conversation

brc-dd
Copy link
Member

@brc-dd brc-dd commented Sep 23, 2025

--- Autogenerated ---

This pull request optimizes how git timestamps are retrieved and cached for markdown files, improving both performance and reliability of the sitemap generation process. The main changes include introducing a new bulk caching function for git timestamps, updating related imports, and ensuring consistent path handling.

Git Timestamp Caching Improvements:

  • Added a new function cacheAllGitTimestamps in src/node/utils/getGitTimestamp.ts to efficiently pre-fetch and cache git timestamps for all markdown files in a repository using a single git command. This reduces the number of individual git calls during site generation.
  • Updated the getGitTimestamp function to use the cached values and improved its logic for parsing git output and handling file paths.

Integration with Build and Plugin System:

  • In src/node/plugin.ts, imported cacheAllGitTimestamps and invoked it in the VitePress plugin setup to pre-resolve timestamps for all markdown files when the lastUpdated feature is enabled. [1] [2]

Path Handling Consistency:

  • Ensured that file paths are normalized using the slash utility when retrieving git timestamps, both in src/node/build/generateSitemap.ts and src/node/utils/getGitTimestamp.ts, to prevent mismatches and improve cross-platform compatibility. [1] [2] [3]

@brc-dd
Copy link
Member Author

brc-dd commented Sep 23, 2025

/publish

Copy link

pkg-pr-new bot commented Sep 23, 2025

npm i https://pkg.pr.new/vitepress@4958

commit: 6e8239a

@brc-dd brc-dd requested a review from Copilot September 23, 2025 16:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request optimizes git timestamp retrieval for VitePress by implementing bulk caching to reduce individual git calls during site generation. The optimization pre-fetches all git timestamps using a single git command and caches them for later use.

  • Introduces cacheAllGitTimestamps function to bulk retrieve and cache git timestamps for all markdown files
  • Integrates timestamp pre-caching into the VitePress plugin setup when lastUpdated is enabled
  • Normalizes file paths using the slash utility for cross-platform compatibility

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/node/utils/getGitTimestamp.ts Adds bulk caching function and updates existing timestamp retrieval logic
src/node/plugin.ts Integrates pre-caching into plugin setup when lastUpdated feature is enabled
src/node/build/generateSitemap.ts Normalizes file paths when calling getGitTimestamp

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@brc-dd brc-dd merged commit 6dfcdd3 into main Sep 25, 2025
10 of 18 checks passed
@brc-dd brc-dd deleted the perf/faster-git-timestamps branch September 25, 2025 09:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants