Skip to content

fix(utils): Make execa usage consistent in git utils#12028

Merged
slorber merged 5 commits into
facebook:mainfrom
zpao:execagit
May 21, 2026
Merged

fix(utils): Make execa usage consistent in git utils#12028
slorber merged 5 commits into
facebook:mainfrom
zpao:execagit

Conversation

@zpao

@zpao zpao commented May 15, 2026

Copy link
Copy Markdown
Contributor

This brings the usage in line with the rest of the calls to git.

This brings the usage in line with the rest of the calls to git.
@zpao zpao requested a review from slorber as a code owner May 15, 2026 19:03
Copilot AI review requested due to automatic review settings May 15, 2026 19:03
@zpao zpao requested a review from Josh-Cena as a code owner May 15, 2026 19:03
@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label May 15, 2026
@netlify

netlify Bot commented May 15, 2026

Copy link
Copy Markdown

[V2]

Name Link
🔨 Latest commit c314d5a
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a0ef5afd4409a0008f80f3c
😎 Deploy Preview https://deploy-preview-12028--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates getFileCommitDate() in Docusaurus’ git utilities to invoke git log via execa('git', [...args]) instead of building a single shell command string, aiming to align the calling style with other git invocations in the module.

Changes:

  • Replaces a string-based git command with an argv-based execa('git', args, options) call for git log.
  • Refactors conditional args for the “oldest” case into an array spread (--follow, --diff-filter=A).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/docusaurus-utils/src/vcs/gitUtils.ts
Comment thread packages/docusaurus-utils/src/vcs/gitUtils.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@Dharya-dev Dharya-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a great cleanup! Moving away from shell: true and raw string concatenation for the git command arguments is much safer and avoids potential shell injection or escaping issues with paths containing special characters.

Using the array format for execa is definitely the best practice here. The code looks cleaner and more robust now. Thanks for standardizing this!

@slorber slorber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, but I'll do a few more tests before merging later this week, because with our new VCS system I don't think our e2e tests cover this code path anymore.

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label May 21, 2026
@slorber slorber changed the title Make execa usage consistent in git utils fix(utils): Make execa usage consistent in git utils May 21, 2026
@slorber slorber merged commit db31c5b into facebook:main May 21, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants