feat(submodules): add submodule management and recursive clone
Add a new backend module to manage Git submodules (list, initialize/update, stage, sync, add) and expose Tauri commands (list_submodules, submodule_action, add_submodule). The implementation enforces safe relative paths, a maximum nesting depth, and guards (dirty/conflicted checks and initialization/no-op semantics) to avoid unsafe operations. Refactor clone logic to a testable run_git_clone_command and enable automatic initialization of submodules during clone by passing --recurse-submodules. Also disallow certain submodule-related custom clone flags so callers cannot override this behaviour. Update README with a Submodules section and add frontend components and types to surface submodule UI (dialogs, toolbar badge). Unit tests were added for submodule discovery, initialization/update semantics, and recursive clone behavior.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
Box,
|
||||
Boxes,
|
||||
Bug,
|
||||
ChevronDown,
|
||||
Code2,
|
||||
@@ -44,6 +45,8 @@
|
||||
export let onFetchPrune: () => void = () => {};
|
||||
export let onForcePush: () => void = () => {};
|
||||
export let onSyncOptions: () => void = () => {};
|
||||
export let uninitializedSubmoduleCount = 0;
|
||||
export let onOpenSubmodules: () => void = () => {};
|
||||
export let onOpenLfs: () => void = () => {};
|
||||
|
||||
let historyOpen = false;
|
||||
@@ -51,6 +54,9 @@
|
||||
let toolbarElement: HTMLDivElement;
|
||||
|
||||
$: isGerman = language === "de";
|
||||
$: submoduleLabel = uninitializedSubmoduleCount > 0
|
||||
? (isGerman ? `Submodule verwalten – ${uninitializedSubmoduleCount} nicht initialisiert` : `Manage submodules – ${uninitializedSubmoduleCount} not initialized`)
|
||||
: (isGerman ? "Submodule verwalten" : "Manage submodules");
|
||||
$: pushLabel = localOnly ? (isGerman ? "Veröffentlichen" : "Publish") : "Push";
|
||||
$: pushTitle = localOnly
|
||||
? (isGerman
|
||||
@@ -220,6 +226,18 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<button
|
||||
class="repo-action"
|
||||
type="button"
|
||||
onclick={onOpenSubmodules}
|
||||
disabled={!hasRepository || isBusy}
|
||||
title={submoduleLabel}
|
||||
aria-label={submoduleLabel}
|
||||
>
|
||||
<Boxes size={15} aria-hidden="true" />
|
||||
<span class="repo-action-label">{isGerman ? "Submodule" : "Submodules"}</span>
|
||||
{#if uninitializedSubmoduleCount > 0}<span class="repo-action-count ahead" aria-hidden="true">{uninitializedSubmoduleCount}</span>{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="repo-toolbar-spacer"></div>
|
||||
|
||||
Reference in New Issue
Block a user