Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Use current_branch instead of target_branch in squash message (#1319)

ricafeal4e047e44bab3
diff --git a/src/llm.rs b/src/llm.rs
index 10ab4612a..52035b77a 100644
--- a/src/llm.rs
+++ b/src/llm.rs
@@ -601,7 +601,7 @@ pub(crate) fn generate_squash_message(
}
// Fallback: deterministic commit message (only when not configured)
- let mut commit_message = format!("Squash commits from {}\n\n", target_branch);
+ let mut commit_message = format!("Squash commits from {}\n\n", current_branch);
commit_message.push_str("Combined commits:\n");
for subject in subjects.iter().rev() {
// Reverse so they're in chronological order
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
index 5a5fc1156..e289d3c76 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
@@ -13,7 +13,6 @@ info:
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
@@ -46,13 +45,13 @@ exit_code: 0
↳ Backup created @ ba39431
◎ Generating squash commit message...
↳ Using fallback commit message. For LLM setup guide, run wt config --help
-  Squash commits from main
+  Squash commits from feature
 
  Combined commits:
  - feat: initial feature
✓ Squashed @ [HASH]
◎ Merging 1 commit to main @ [HASH] (no rebase needed)
-  * [HASH] Squash commits from main
+  * [HASH] Squash commits from feature
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_collected_for_squash_clean_worktree.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_collected_for_squash_clean_worktree.snap
index a4e28555d..702a099ec 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_collected_for_squash_clean_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_collected_for_squash_clean_worktree.snap
@@ -14,7 +14,6 @@ info:
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
@@ -49,7 +48,7 @@ exit_code: 0
◎ Squashing 3 commits into a single commit (3 files, +3)...
◎ Generating squash commit message...
↳ Using fallback commit message. For LLM setup guide, run wt config --help
-  Squash commits from main
+  Squash commits from feature
 
  Combined commits:
  - feat: add file 1
@@ -57,7 +56,7 @@ exit_code: 0
  - Add config
✓ Squashed @ [HASH]
◎ Merging 1 commit to main @ [HASH] (no rebase needed)
-  * [HASH] Squash commits from main
+  * [HASH] Squash commits from feature
  .config/wt.toml | 1 +
  file1.txt | 1 +
  file2.txt | 1 +
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
index a9b8e05aa..7ca3f946e 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -13,7 +13,6 @@ info:
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
@@ -45,7 +44,7 @@ exit_code: 0
◎ Squashing 3 commits into a single commit (3 files, +3)...
◎ Generating squash commit message...
↳ Using fallback commit message. For LLM setup guide, run wt config --help
-  Squash commits from main
+  Squash commits from feature
 
  Combined commits:
  - feat: add file 1
@@ -53,7 +52,7 @@ exit_code: 0
  - docs: update readme
✓ Squashed @ [HASH]
◎ Merging 1 commit to main @ [HASH] (no rebase needed)
-  * [HASH] Squash commits from main
+  * [HASH] Squash commits from feature
  file1.txt | 1 +
  file2.txt | 1 +
  file3.txt | 1 +
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
index 4448b214e..a91d2e851 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
@@ -13,7 +13,6 @@ info:
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
@@ -45,7 +44,7 @@ exit_code: 0
◎ Squashing 3 commits into a single commit...
◎ Generating squash commit message...
↳ Using fallback commit message. For LLM setup guide, run wt config --help
-  Squash commits from main
+  Squash commits from feature
 
  Combined commits:
  - Change 1