feat(remote): support authenticated deletion of remote branches
Add support for authenticated deletion of remote branches and folders. The backend adds a batch delete command that queries the remote, performs an atomic push --delete when possible with a fallback, and prunes stale tracking refs; it accepts optional credentials. The frontend and JS API integrate credential handling and prompt users when authentication is required. - New batch deletion command with optional username/password for auth. - Uses ls-remote to scope deletions, tries --atomic then falls back. - Frontend updates: credential dialog/action, pendingRemoteDelete state.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
} from "@lucide/svelte";
|
||||
|
||||
interface Props {
|
||||
action: "push" | "pull" | "fetch" | "clone" | "rename";
|
||||
action: "push" | "pull" | "fetch" | "clone" | "rename" | "delete";
|
||||
error: string;
|
||||
isBusy: boolean;
|
||||
initialUsername?: string;
|
||||
@@ -47,19 +47,21 @@
|
||||
password.trim().length > 0 &&
|
||||
username.trim().length > 0,
|
||||
);
|
||||
let actionLabel = $derived(action === "push" ? "Push" : action === "fetch" ? "Fetch" : action === "clone" ? "Clone" : action === "rename" ? "Rename" : "Pull");
|
||||
let actionLabel = $derived(action === "push" ? "Push" : action === "fetch" ? "Fetch" : action === "clone" ? "Clone" : action === "rename" ? "Rename" : action === "delete" ? "Delete" : "Pull");
|
||||
let actionTitle = $derived(
|
||||
action === "push"
|
||||
? "Authenticate push"
|
||||
: action === "rename"
|
||||
? "Authenticate remote rename"
|
||||
: action === "fetch"
|
||||
? "Authenticate fetch"
|
||||
: action === "clone"
|
||||
? "Authenticate clone"
|
||||
: "Authenticate pull",
|
||||
: action === "delete"
|
||||
? "Authenticate remote deletion"
|
||||
: action === "fetch"
|
||||
? "Authenticate fetch"
|
||||
: action === "clone"
|
||||
? "Authenticate clone"
|
||||
: "Authenticate pull",
|
||||
);
|
||||
let actionHint = $derived(action === "push" || action === "rename"
|
||||
let actionHint = $derived(action === "push" || action === "rename" || action === "delete"
|
||||
? "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."
|
||||
@@ -80,7 +82,7 @@
|
||||
<div class="cred-hero">
|
||||
<div class="cred-hero-top">
|
||||
<div class="cred-hero-icon">
|
||||
{#if action === "push" || action === "rename"}
|
||||
{#if action === "push" || action === "rename" || action === "delete"}
|
||||
<Upload size={27} aria-hidden="true" />
|
||||
{:else}
|
||||
<Download size={27} aria-hidden="true" />
|
||||
|
||||
Reference in New Issue
Block a user