From 85ef033dcdf4c81e0d5e6d505ae53475234575e2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Dec 2025 04:16:40 +0000 Subject: [PATCH 1/2] Show Git authentication section on Windows with only executable option Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- apps/desktop/src/components/GitForm.svelte | 8 +- apps/desktop/src/components/KeysForm.svelte | 111 ++++++++++-------- .../shared/src/lib/branches/Minimap.svelte | 2 +- 3 files changed, 66 insertions(+), 55 deletions(-) diff --git a/apps/desktop/src/components/GitForm.svelte b/apps/desktop/src/components/GitForm.svelte index 9cc6c0c87a..24074d5b05 100644 --- a/apps/desktop/src/components/GitForm.svelte +++ b/apps/desktop/src/components/GitForm.svelte @@ -3,7 +3,6 @@ import KeysForm from '$components/KeysForm.svelte'; import ReduxResult from '$components/ReduxResult.svelte'; import SettingsSection from '$components/SettingsSection.svelte'; - import { BACKEND } from '$lib/backend'; import { PROJECTS_SERVICE } from '$lib/project/projectsService'; import { inject } from '@gitbutler/core/context'; import { CardGroup, Spacer, Toggle } from '@gitbutler/ui'; @@ -12,7 +11,6 @@ const { projectId }: { projectId: string } = $props(); const projectsService = inject(PROJECTS_SERVICE); const projectQuery = $derived(projectsService.getProject(projectId)); - const backend = inject(BACKEND); async function onForcePushClick(project: Project, value: boolean) { await projectsService.updateProject({ ...project, ok_with_force_push: value }); @@ -25,10 +23,8 @@ - {#if backend.platformName !== 'windows'} - - - {/if} + + diff --git a/apps/desktop/src/components/KeysForm.svelte b/apps/desktop/src/components/KeysForm.svelte index 99b251d96e..47ec92383f 100644 --- a/apps/desktop/src/components/KeysForm.svelte +++ b/apps/desktop/src/components/KeysForm.svelte @@ -3,6 +3,7 @@ import ProjectNameLabel from '$components/ProjectNameLabel.svelte'; import ReduxResult from '$components/ReduxResult.svelte'; import SettingsSection from '$components/SettingsSection.svelte'; + import { BACKEND } from '$lib/backend'; import { BASE_BRANCH_SERVICE } from '$lib/baseBranch/baseBranchService.svelte'; import { showError } from '$lib/notifications/toasts'; import { type AuthKey, type KeyType } from '$lib/project/project'; @@ -36,11 +37,18 @@ const projectsService = inject(PROJECTS_SERVICE); const projectQuery = $derived(projectsService.getProject(projectId)); const project = $derived(projectQuery.response); + const backend = inject(BACKEND); + const isWindows = $derived(backend.platformName === 'windows'); let credentialCheck = $state(); + function getDefaultCredentialType(): KeyType { + // Use systemExecutable on Windows since other options are not available + return isWindows ? 'systemExecutable' : 'local'; + } + let selectedType: KeyType = $derived( - typeof project?.preferred_key === 'string' ? project?.preferred_key : 'local' + typeof project?.preferred_key === 'string' ? project?.preferred_key : getDefaultCredentialType() ); let privateKeyPath = $state(''); @@ -104,6 +112,11 @@ {#snippet description()} Configure the authentication flow for GitButler when authenticating with your Git remote provider. + {#if isWindows} +

+ Note: On Windows, only the Git executable option is available for compatibility + reasons. + {/if} {/snippet}
- - {#snippet title()} - Use existing SSH key - {/snippet} - - {#snippet actions()} - - {/snippet} - - {#snippet caption()} - {#if selectedType === 'local'} - Add the path to an existing SSH key that GitButler can use. - {/if} - {/snippet} - + {#if !isWindows} + + {#snippet title()} + Use existing SSH key + {/snippet} + + {#snippet actions()} + + {/snippet} + + {#snippet caption()} + {#if selectedType === 'local'} + Add the path to an existing SSH key that GitButler can use. + {/if} + {/snippet} + - {#if selectedType === 'local'} - -
- { - debouncedUpdateLocalKey(value); - }} + {#if selectedType === 'local'} + +
+ { + debouncedUpdateLocalKey(value); + }} + /> +
+
+ {/if} + + + {#snippet title()} + Use a Git credentials helper + {/snippet} + + {#snippet caption()} + {#if selectedType === 'gitCredentialsHelper'} + GitButler will use the system's git credentials helper. + Learn more + {/if} + {/snippet} + + {#snippet actions()} + -
+ {/snippet}
{/if} - - {#snippet title()} - Use a Git credentials helper - {/snippet} - - {#snippet caption()} - {#if selectedType === 'gitCredentialsHelper'} - GitButler will use the system's git credentials helper. - Learn more - {/if} - {/snippet} - - {#snippet actions()} - - {/snippet} - - Date: Sat, 20 Dec 2025 09:41:58 +0100 Subject: [PATCH 2/2] refactor --- apps/desktop/src/components/KeysForm.svelte | 2 +- packages/shared/src/lib/branches/Minimap.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/components/KeysForm.svelte b/apps/desktop/src/components/KeysForm.svelte index 47ec92383f..fdab61dc4d 100644 --- a/apps/desktop/src/components/KeysForm.svelte +++ b/apps/desktop/src/components/KeysForm.svelte @@ -114,7 +114,7 @@ provider. {#if isWindows}

- Note: On Windows, only the Git executable option is available for compatibility + On Windows, only the Git executable option is available for compatibility reasons. {/if} {/snippet} diff --git a/packages/shared/src/lib/branches/Minimap.svelte b/packages/shared/src/lib/branches/Minimap.svelte index 88f09bffde..ef91f04005 100644 --- a/packages/shared/src/lib/branches/Minimap.svelte +++ b/packages/shared/src/lib/branches/Minimap.svelte @@ -2,11 +2,11 @@ import { goto } from '$app/navigation'; import ChangeStatus from '$lib/patches/ChangeStatus.svelte'; import { WEB_ROUTES_SERVICE } from '$lib/routing/webRoutes.svelte'; - import { inject } from '@gitbutler/core/context'; import { getBranchReview } from '@gitbutler/shared/branches/branchesPreview.svelte'; import { isFound, map } from '@gitbutler/shared/network/loadable'; import { getPatch } from '@gitbutler/shared/patches/patchCommitsPreview.svelte'; import { reactive } from '@gitbutler/shared/reactiveUtils.svelte'; + import { inject } from '@gitbutler/core/context'; import { CommitStatusBadge } from '@gitbutler/ui'; import { EXTERNAL_LINK_SERVICE,