fix: respect git.requireGitUserConfig setting on commit errors#304983
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: respect git.requireGitUserConfig setting on commit errors#304983yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When git.requireGitUserConfig is set to false, handleCommitError still checks for user.name and user.email configuration on any commit failure, showing the misleading message 'Make sure you configure your user.name and user.email in git' even though the user explicitly opted out of this requirement. Pass the requireUserConfig flag to handleCommitError and skip the user config validation when it is false, allowing the actual commit error to surface instead. Closes microsoft#194102
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
When
git.requireGitUserConfigis set tofalse, committing still shows the error message "Make sure you configure your user.name and user.email in git" if any commit error occurs and user.name or user.email is not configured.The issue is in
handleCommitError(): regardless of therequireUserConfigsetting, it always checks foruser.nameanduser.emailon any commit failure and throwsNoUserNameConfigured/NoUserEmailConfigurederrors, masking the actual commit error.Closes #194102
What is the new behavior?
The
requireUserConfigflag is now passed from thecommit()method tohandleCommitError(). Whengit.requireGitUserConfigisfalse, the user config validation is skipped and the actual commit error is surfaced to the user instead.The
rebaseContinue()method continues to use the defaultrequireUserConfig = truebehavior since it has no corresponding setting.Additional context
The
commit()method correctly respects the setting by conditionally adding-c user.useConfigOnly=true, but the error handler was independently checking user config and overriding the actual error. This fix aligns the error handling with the commit configuration.