Skip to content

strip out git askpass sourcemap footer#291673

Merged
joaomoreno merged 1 commit intomainfrom
joao/cyan-tyrannosaurus
Jan 29, 2026
Merged

strip out git askpass sourcemap footer#291673
joaomoreno merged 1 commit intomainfrom
joao/cyan-tyrannosaurus

Conversation

@joaomoreno
Copy link
Copy Markdown
Member

fixes #282020

@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@lszomoru

Matched files:

  • extensions/git/extension.webpack.config.js

@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 29, 2026
Copy link
Copy Markdown
Contributor

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

Adds a build-time mechanism to remove the //# sourceMappingURL=... footer from specific bundled extension artifacts (currently Git’s askpass-main.js) to address the terminal environment-variable churn reported in #282020.

Changes:

  • Introduces a StripOutSourceMaps export in the Git extension webpack config to mark dist/askpass-main.js for special handling.
  • Updates the extension packaging pipeline (build/lib/extensions.ts) to either rewrite sourceMappingURL to the CDN (existing behavior) or remove it entirely for configured files.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
extensions/git/extension.webpack.config.js Declares dist/askpass-main.js as a bundle whose sourcemap footer should be stripped.
build/lib/extensions.ts Reads StripOutSourceMaps from extension webpack configs and conditionally removes vs rewrites the sourceMappingURL footer during packaging.

Comment thread build/lib/extensions.ts
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
}), 'utf8');
if (stripOutSourceMaps.indexOf(data.relative) >= 0) { // remove source map
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

data.relative is derived from path.relative(...) (via Vinyl) and will use platform-specific path separators (e.g. dist\\askpass-main.js on Windows). Since StripOutSourceMaps values are authored with POSIX separators (dist/askpass-main.js), this comparison won’t match on Windows builds and the sourceMappingURL footer won’t be stripped. Normalize both sides (e.g. path.normalize(...) when collecting and comparing, or convert to POSIX with replace(/\\/g, '/')) and consider using a Set + has() for clarity.

Suggested change
if (stripOutSourceMaps.indexOf(data.relative) >= 0) { // remove source map
const stripOutSourceMapsSet = new Set(stripOutSourceMaps.map(p => path.normalize(p)));
const normalizedRelativePath = path.normalize(data.relative);
if (stripOutSourceMapsSet.has(normalizedRelativePath)) { // remove source map

Copilot uses AI. Check for mistakes.
@joaomoreno joaomoreno merged commit bf729fa into main Jan 29, 2026
27 of 28 checks passed
@joaomoreno joaomoreno deleted the joao/cyan-tyrannosaurus branch January 29, 2026 18:27
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Mar 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git keeps changing environment variables due to new Windows installer

3 participants