Skip to content

git: fix wrong value used when migrating user inputValidation setting#309173

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/git-input-validation-migration-bug
Open

git: fix wrong value used when migrating user inputValidation setting#309173
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/git-input-validation-migration-bug

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

When migrating the legacy string-based git.inputValidation setting to the new boolean form, the user (global) setting migration incorrectly read workspaceValue instead of globalValue to compute the new boolean.

This meant that if someone had a workspace setting but not a user setting, the migration would still run (since globalValue is checked for the typeof guard), but would use the workspace value instead of the user value, producing incorrect results.

Before:

// User setting
if (typeof inputValidation.globalValue === string) {
    await config.update(inputValidation, inputValidation.workspaceValue !== off, true);
}

After:

// User setting
if (typeof inputValidation.globalValue === string) {
    await config.update(inputValidation, inputValidation.globalValue !== off, true);
}

Fixes the copy-paste mistake introduced in the migration helper.

@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering bot commented Apr 11, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/src/diagnostics.ts

When migrating the legacy string-based `git.inputValidation` user setting
to the new boolean form, the code incorrectly checked `workspaceValue`
instead of `globalValue` to determine the new boolean value. This meant
the global (user) setting was being migrated based on the workspace
setting value rather than the actual user setting value.
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.

2 participants