Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix: disable submodule recursion in local push and reset (#1619)
worktrunk-bot344082f102b4
diff --git a/src/commands/worktree/push.rs b/src/commands/worktree/push.rsindex fb5c935d6..bd809aa15 100644--- a/src/commands/worktree/push.rs+++ b/src/commands/worktree/push.rs@@ -268,6 +268,7 @@ pub fn handle_push(ctx.repo.run_command(&["push",+ "--recurse-submodules=no","--receive-pack=git -c receive.denyCurrentBranch=updateInstead receive-pack",git_common_dir_str.as_ref(),&push_target,diff --git a/tests/integration_tests/push.rs b/tests/integration_tests/push.rsindex 4d8ff40ec..84dc864ef 100644--- a/tests/integration_tests/push.rs+++ b/tests/integration_tests/push.rs@@ -255,6 +255,46 @@ fn test_push_no_ff(mut repo: TestRepo) {assert_eq!(commit_msg, "Merge branch 'feature' into main");}+#[rstest]+fn test_push_with_submodule_recurse_config(mut repo: TestRepo) {+ // Regression test for https://github.com/max-sixty/worktrunk/issues/1604+ // When submodule.recurse=true is set, git push tries to recurse into+ // submodules which fails for local worktree-to-worktree pushes.+ repo.run_git(&["config", "submodule.recurse", "true"]);++ repo.add_main_worktree();++ let feature_wt =+ repo.add_worktree_with_commit("feature", "test.txt", "test content", "Add test file");++ // Fast-forward push should succeed despite submodule.recurse=true+ snapshot_push(+ "push_with_submodule_recurse",+ &repo,+ &["main"],+ Some(&feature_wt),+ );+}++#[rstest]+fn test_push_no_ff_with_submodule_recurse_config(mut repo: TestRepo) {+ // Regression test for https://github.com/max-sixty/worktrunk/issues/1604+ repo.run_git(&["config", "submodule.recurse", "true"]);++ repo.add_main_worktree();++ let feature_wt =+ repo.add_worktree_with_commit("feature", "test.txt", "test content", "Add test file");++ // No-ff push should succeed despite submodule.recurse=true+ snapshot_push(+ "push_no_ff_with_submodule_recurse",+ &repo,+ &["--no-ff", "main"],+ Some(&feature_wt),+ );+}+#[rstest]fn test_push_no_remote(#[from(repo_with_feature_worktree)] repo: TestRepo) {// Note: repo_with_feature_worktree doesn't call setup_remote(), so this tests the "no remote" error casediff --git a/tests/snapshots/integration__integration_tests__push__push_no_ff_with_submodule_recurse.snap b/tests/snapshots/integration__integration_tests__push__push_no_ff_with_submodule_recurse.snapnew file mode 100644index 000000000..1cc648982--- /dev/null+++ b/tests/snapshots/integration__integration_tests__push__push_no_ff_with_submodule_recurse.snap@@ -0,0 +1,51 @@+---+source: tests/integration_tests/push.rs+info:+ program: wt+ args:+ - step+ - push+ - "--no-ff"+ - main+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"+ NO_COLOR: ""+ PATH: "[PATH]"+ PSModulePath: ""+ RUST_LOG: warn+ SHELL: ""+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+[36m◎[39m [36mMerging 1 commit to [1mmain[22m @ [2m[HASH][22m (--no-ff)[39m+[107m [0m * [33m[HASH][m Add test file+[107m [0m test.txt | 1 [32m+[m+[107m [0m 1 file changed, 1 insertion(+)+[32m✓[39m [32mMerged to [1mmain[22m @ [2m[HASH][22m [90m(1 commit, 1 file, [32m+1[39m, --no-ff[39m[90m)[39m[39mdiff --git a/tests/snapshots/integration__integration_tests__push__push_with_submodule_recurse.snap b/tests/snapshots/integration__integration_tests__push__push_with_submodule_recurse.snapnew file mode 100644index 000000000..bc6512c00--- /dev/null+++ b/tests/snapshots/integration__integration_tests__push__push_with_submodule_recurse.snap@@ -0,0 +1,50 @@+---+source: tests/integration_tests/push.rs+info:+ program: wt+ args:+ - step+ - push+ - main+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"+ NO_COLOR: ""+ PATH: "[PATH]"+ PSModulePath: ""+ RUST_LOG: warn+ SHELL: ""+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+[36m◎[39m [36mPushing 1 commit to [1mmain[22m @ [2m[HASH][22m[39m+[107m [0m * [33m[HASH][m Add test file+[107m [0m test.txt | 1 [32m+[m+[107m [0m 1 file changed, 1 insertion(+)+[32m✓[39m [32mPushed to [1mmain[22m [90m(1 commit, 1 file, [32m+1[39m[39m[90m)[39m[39m