Add submodule management and collapsible Worktree/Tags panels #45

Merged
Christoph merged 0 commits from refs/pull/45/head into main 2026-09-16 20:59:41 +00:00
Christoph commented 2026-09-16 20:59:28 +00:00 (Migrated from git.cbsk-tech.de)

This change adds first-class submodule support in the backend and UI adjustments to the left sidebar (new Worktree and Tags panels that can be collapsed and persist size/state). The clone implementation was changed to initialize submodules automatically (including nested submodules) during clone.

What changed (summary):

  • Submodule backend: a new module src-tauri/src/git/submodules.rs implements listing, adding, initializing/updating, staging references and syncing submodule URLs. It exposes Tauri commands: list_submodules, add_submodule and submodule_action (registered in src-tauri/src/main.rs).
  • Clone behavior: src-tauri/src/git.rs was modified so run_git_clone_command passes --recurse-submodules by default to git clone, and parse_custom_clone_flags now rejects conflicting custom flags such as --no-recurse-submodules, --no-recursive and --remote-submodules.
  • UI: App.svelte now imports WorktreePanel and TagsPanel, adds persistent keys and state for collapsing and resizing those panels (new stored keys and load/store logic), and wires submodule-related state variables for loading/initializing submodules.
  • Documentation: README.md updated with a Submodules section describing behavior (automatic initialization on clone, submodule dialog capabilities, and examples of operations).
  • Tests: unit tests were added/extended for nested submodules and submodule operations (tests appear in src-tauri/src/git.rs and src-tauri/src/git/submodules.rs).

Why this matters (behavioral evidence from the diff):

  • Cloning now runs git clone --recurse-submodules (code: run_git_clone_command adds --recurse-submodules), so clones should automatically download and initialize submodules (including nested ones) at their recorded commits. There are new tests that validate that nested submodules are downloaded at the recorded commits and that submodule status shows initialized modules.
  • The new submodules.rs implements safe path checks, discovery of submodules from the index and .gitmodules, operations that call git submodule update --init --checkout (with --recursive when requested), and commands to add/sync/stage references. The Tauri commands expose this functionality to the UI.
  • App.svelte changes show the UI impact: new import of TagsPanel and WorktreePanel, new stored keys and collapsed state variables, and hooks for listing/adding/submodule actions.

Tests and execution:

  • New unit tests are included (git clone/submodule related tests added). No test execution results were provided.

Recommended reviewer checks:

  • Run the backend unit tests (cargo test in src-tauri) locally to confirm the new tests pass.
  • Verify a real or local file:// repository with nested submodules: clone it via the application or run the code path that uses run_git_clone_command to confirm submodules are initialized at recorded commits and nested modules are present but not updated to newer unpinned commits.
  • In the running app, confirm Worktree and Tags panels are present in the left sidebar, can be collapsed/expanded, and their sizes/state persist.
  • Exercise submodule operations from the UI (list, initialize/update, stage, sync, add) and confirm the commands call the expected git submodule actions and that errors for dirty/uninitialized states are surfaced.

Compatibility / notes:

  • Clone behavior changed to include submodule initialization by default; this is a concrete behavioral change evident in the clone command construction. If callers relied on clones not fetching submodules, they will now get submodules fetched and initialized unless the code path that constructs custom clone flags is adjusted elsewhere.
  • parse_custom_clone_flags now rejects certain flags that would conflict with the enforced recurse-submodules behavior; callers that pass those flags will receive an error from parse_custom_clone_flags as added in the diff.

Files of interest (high level):

  • Added: src-tauri/src/git/submodules.rs (implements submodule logic and tests)
  • Modified: src-tauri/src/git.rs (clone behavior, tests, and flag parsing)
  • Modified: src-tauri/src/main.rs (registers new Tauri commands)
  • Modified: src/App.svelte (imports and state for Worktree/Tags panels and submodule UI state)
  • Modified: README.md (Submodules documentation)

No test execution results were provided.

This change adds first-class submodule support in the backend and UI adjustments to the left sidebar (new Worktree and Tags panels that can be collapsed and persist size/state). The clone implementation was changed to initialize submodules automatically (including nested submodules) during clone. What changed (summary): - Submodule backend: a new module src-tauri/src/git/submodules.rs implements listing, adding, initializing/updating, staging references and syncing submodule URLs. It exposes Tauri commands: list_submodules, add_submodule and submodule_action (registered in src-tauri/src/main.rs). - Clone behavior: src-tauri/src/git.rs was modified so run_git_clone_command passes --recurse-submodules by default to git clone, and parse_custom_clone_flags now rejects conflicting custom flags such as --no-recurse-submodules, --no-recursive and --remote-submodules. - UI: App.svelte now imports WorktreePanel and TagsPanel, adds persistent keys and state for collapsing and resizing those panels (new stored keys and load/store logic), and wires submodule-related state variables for loading/initializing submodules. - Documentation: README.md updated with a Submodules section describing behavior (automatic initialization on clone, submodule dialog capabilities, and examples of operations). - Tests: unit tests were added/extended for nested submodules and submodule operations (tests appear in src-tauri/src/git.rs and src-tauri/src/git/submodules.rs). Why this matters (behavioral evidence from the diff): - Cloning now runs git clone --recurse-submodules (code: run_git_clone_command adds --recurse-submodules), so clones should automatically download and initialize submodules (including nested ones) at their recorded commits. There are new tests that validate that nested submodules are downloaded at the recorded commits and that submodule status shows initialized modules. - The new submodules.rs implements safe path checks, discovery of submodules from the index and .gitmodules, operations that call git submodule update --init --checkout (with --recursive when requested), and commands to add/sync/stage references. The Tauri commands expose this functionality to the UI. - App.svelte changes show the UI impact: new import of TagsPanel and WorktreePanel, new stored keys and collapsed state variables, and hooks for listing/adding/submodule actions. Tests and execution: - New unit tests are included (git clone/submodule related tests added). No test execution results were provided. Recommended reviewer checks: - Run the backend unit tests (cargo test in src-tauri) locally to confirm the new tests pass. - Verify a real or local file:// repository with nested submodules: clone it via the application or run the code path that uses run_git_clone_command to confirm submodules are initialized at recorded commits and nested modules are present but not updated to newer unpinned commits. - In the running app, confirm Worktree and Tags panels are present in the left sidebar, can be collapsed/expanded, and their sizes/state persist. - Exercise submodule operations from the UI (list, initialize/update, stage, sync, add) and confirm the commands call the expected git submodule actions and that errors for dirty/uninitialized states are surfaced. Compatibility / notes: - Clone behavior changed to include submodule initialization by default; this is a concrete behavioral change evident in the clone command construction. If callers relied on clones not fetching submodules, they will now get submodules fetched and initialized unless the code path that constructs custom clone flags is adjusted elsewhere. - parse_custom_clone_flags now rejects certain flags that would conflict with the enforced recurse-submodules behavior; callers that pass those flags will receive an error from parse_custom_clone_flags as added in the diff. Files of interest (high level): - Added: src-tauri/src/git/submodules.rs (implements submodule logic and tests) - Modified: src-tauri/src/git.rs (clone behavior, tests, and flag parsing) - Modified: src-tauri/src/main.rs (registers new Tauri commands) - Modified: src/App.svelte (imports and state for Worktree/Tags panels and submodule UI state) - Modified: README.md (Submodules documentation) No test execution results were provided.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Christoph/Gitty!45
No description provided.