Use origin instead of protocol, host for git credentials

This commit is contained in:
Alex Gleason committed 2025-12-21 00:08:56 -06:00
1 parent 9c2f4f9eb6
commit fcc305788d
7 files changed
+34 -82

No files matched your search

+9 -4
View File
@@ -3,15 +3,20 @@ import { findCredentialsForRepo } from './gitCredentials';
import type { GitCredential } from '@/contexts/GitSettingsContext';
// Helper to create test credentials with required fields
function createTestCredential(overrides: Partial<GitCredential>): GitCredential {
function createTestCredential(overrides: Partial<GitCredential> & { protocol?: string; host?: string } = {}): GitCredential {
// Extract protocol and host if provided (for backward compatibility with tests)
const { protocol = 'https', host = 'github.com', ...rest } = overrides;
// Construct origin from protocol and host if origin is not provided
const origin = rest.origin || `${protocol}://${host}`;
return {
id: crypto.randomUUID(),
name: 'Test Credential',
protocol: 'https',
host: 'github.com',
origin,
username: 'user',
password: 'pass',
...overrides,
...rest,
};
}