Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions actions/setup/js/git_helpers.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@ describe("git_helpers.cjs", () => {
};

try {
// Try a git command with a URL containing credentials (will fail but that's ok)
// Use a git command that doesn't require network access
// We'll use 'ls-remote' with --exit-code and a URL with credentials
// This will fail quickly without attempting network access
Comment on lines +84 to +85
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The new comment block mentions using ls-remote with --exit-code, but the test now calls git config --get .... Please update/remove the ls-remote wording so the comment matches the actual command and rationale (avoid network access).

Suggested change
// We'll use 'ls-remote' with --exit-code and a URL with credentials
// This will fail quickly without attempting network access
// We'll use 'git config --get' on a remote URL with embedded credentials
// This should fail quickly without attempting network access, while still logging the command

Copilot uses AI. Check for mistakes.
try {
execGitSync(["fetch", "https://user:token@github.com/repo.git", "main"]);
execGitSync(["config", "--get", "remote.https://user:token@github.com/repo.git.url"]);
} catch (e) {
// Expected to fail, we're just checking the logging
}

// Check that credentials were redacted in the log
const fetchLog = debugLogs.find(log => log.includes("git fetch"));
expect(fetchLog).toBeDefined();
expect(fetchLog).toContain("https://***@github.com/repo.git");
expect(fetchLog).not.toContain("user:token");
const configLog = debugLogs.find(log => log.includes("git config"));
expect(configLog).toBeDefined();
expect(configLog).toContain("https://***@github.com/repo.git");
expect(configLog).not.toContain("user:token");
} finally {
global.core = originalCore;
}
Expand Down