mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Use origin instead of protocol, host for git credentials
This commit is contained in:
7 files changed
+34
-82
No files matched your search
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user