feat(git): support credentials for remote branch rename
Allow remote branch renames to be performed with optional credentials so operations against protected remotes succeed when authentication is needed. The backend accepts username/password and uses an authenticated push path when provided, while the frontend prompts for and reuses stored credentials. - Add optional username/password to rename RPC and use authenticated push - Wire UI to queue rename, open credential dialog, and execute rename - Extend credential dialog and handling to include the rename action
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
} from "@lucide/svelte";
|
||||
|
||||
interface Props {
|
||||
action: "push" | "pull" | "fetch" | "clone";
|
||||
action: "push" | "pull" | "fetch" | "clone" | "rename";
|
||||
error: string;
|
||||
isBusy: boolean;
|
||||
initialUsername?: string;
|
||||
@@ -47,17 +47,19 @@
|
||||
password.trim().length > 0 &&
|
||||
username.trim().length > 0,
|
||||
);
|
||||
let actionLabel = $derived(action === "push" ? "Push" : action === "fetch" ? "Fetch" : action === "clone" ? "Clone" : "Pull");
|
||||
let actionLabel = $derived(action === "push" ? "Push" : action === "fetch" ? "Fetch" : action === "clone" ? "Clone" : action === "rename" ? "Rename" : "Pull");
|
||||
let actionTitle = $derived(
|
||||
action === "push"
|
||||
? "Authenticate push"
|
||||
: action === "fetch"
|
||||
: action === "rename"
|
||||
? "Authenticate remote rename"
|
||||
: action === "fetch"
|
||||
? "Authenticate fetch"
|
||||
: action === "clone"
|
||||
? "Authenticate clone"
|
||||
: "Authenticate pull",
|
||||
);
|
||||
let actionHint = $derived(action === "push"
|
||||
let actionHint = $derived(action === "push" || action === "rename"
|
||||
? "The remote needs write access. Use a password or a token with the appropriate repository permissions."
|
||||
: action === "clone"
|
||||
? "The repository needs access before it can be cloned. Use your Git credentials or a personal access token."
|
||||
@@ -78,7 +80,7 @@
|
||||
<div class="cred-hero">
|
||||
<div class="cred-hero-top">
|
||||
<div class="cred-hero-icon">
|
||||
{#if action === "push"}
|
||||
{#if action === "push" || action === "rename"}
|
||||
<Upload size={27} aria-hidden="true" />
|
||||
{:else}
|
||||
<Download size={27} aria-hidden="true" />
|
||||
|
||||
+10
-1
@@ -138,8 +138,17 @@ export function renameRemoteBranch(
|
||||
remote: string,
|
||||
oldBranch: string,
|
||||
newBranch: string,
|
||||
username?: string,
|
||||
password?: string,
|
||||
): Promise<GitStatus> {
|
||||
return invoke<GitStatus>("rename_remote_branch", { path, remote, oldBranch, newBranch });
|
||||
return invoke<GitStatus>("rename_remote_branch", {
|
||||
path,
|
||||
remote,
|
||||
oldBranch,
|
||||
newBranch,
|
||||
username: username ?? null,
|
||||
password: password ?? null,
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteBranch(path: string, branch: string, force = false): Promise<GitStatus> {
|
||||
|
||||
Reference in New Issue
Block a user