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:
2026-09-16 22:31:14 +02:00
parent f0ff1914c9
commit 66c85321ea
11 changed files with 1084 additions and 3 deletions
+4
View File
@@ -10,6 +10,7 @@ use badge::set_sync_badge;
use external_tools::{
detect_external_tools, launch_external_diff, launch_external_merge, launch_external_tool,
};
use git::submodules::{add_submodule, list_submodules, submodule_action};
use git::{
SearchCancellationState, add_remote, add_to_gitignore, add_worktree, amend_commit,
apply_file_patch, cancel_code_search, cancel_file_history, checkout_branch, cherry_pick_abort,
@@ -362,6 +363,9 @@ async fn main() {
rename_branch,
rename_remote_branch,
delete_branch,
list_submodules,
add_submodule,
submodule_action,
list_worktrees,
add_worktree,
remove_worktree,