fix(utils): preserve author names containing commas in git log parsing#12069
Open
Dharya-dev wants to merge 1 commit into
Open
fix(utils): preserve author names containing commas in git log parsing#12069Dharya-dev wants to merge 1 commit into
Dharya-dev wants to merge 1 commit into
Conversation
The eager VCS strategy parses git log output in the format t:<ts>,a:<author>.
When splitting on comma to separate the timestamp and author fields, author
names containing commas (e.g., 'Doe, Jane' or 'Smith, Jr.') were silently
truncated — only the text before the first comma in the name was kept.
This replaces split(',') with indexOf(',a:') to locate the known separator
between the timestamp and author fields, correctly preserving the full
author name regardless of commas it may contain.
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
getGitRepositoryFilesInfo()ingitUtils.tsparsesgit logoutput formatted ast:<timestamp>,a:<author name>. The current implementation useslogLine.split(',')to separate the timestamp from the author name.This breaks when the author's Git
user.namecontains a comma — for example,Doe, JaneorSmith, Jr.. The split produces three array elements instead of two:The
getFileCommitDate()function in the same file avoids this by using a regex with a greedy(?<author>.+)capture group, but the newergetGitRepositoryFilesInfo()function (introduced in the eager VCS strategy) doesn't share that approach.Fix
Replaced
split(',')withindexOf(',a:')to locate the known separator between the timestamp and author fields. This safely handles commas anywhere in the author name:Test plan
Added a regression test in
gitUtils.test.tsthat commits a file with an author name containing a comma (Doe, Jane) and verifies thatgetGitRepositoryFilesInfo()preserves the full name.Checklist