Skip to content

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

refactor: Remove all platform-specific conditional skips from tests (#6)

Maximilian Roos178cb6e85b0f
diff --git a/src/commands/list/model.rs b/src/commands/list/model.rs
index 23ed99105..3c75f8866 100644
--- a/src/commands/list/model.rs
+++ b/src/commands/list/model.rs
@@ -480,8 +480,29 @@ pub fn gather_list_data(
}
}
- // Sort by most recent commit (descending)
- items.sort_by_key(|item| std::cmp::Reverse(item.commit_timestamp()));
+ // Sort by:
+ // 1. Main worktree (primary) always first
+ // 2. Current worktree second (if not main)
+ // 3. Remaining worktrees by age (most recent first)
+ items.sort_by_key(|item| {
+ let is_primary = item.is_primary();
+ let is_current = item
+ .worktree_path()
+ .and_then(|p| current_worktree_path.as_ref().map(|cp| p == cp))
+ .unwrap_or(false);
+
+ // Primary sort key: 0 = main, 1 = current (non-main), 2 = others
+ let priority = if is_primary {
+ 0
+ } else if is_current {
+ 1
+ } else {
+ 2
+ };
+
+ // Secondary sort: timestamp (reversed for descending order)
+ (priority, std::cmp::Reverse(item.commit_timestamp()))
+ });
Ok(Some(ListData {
items,
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 66a546e0d..23899aff1 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -299,7 +299,7 @@ pub fn handle_merge(
/// Format the merge summary message (includes emoji and color for consistency)
fn format_merge_summary(primary_path: Option<&std::path::Path>) -> String {
- use worktrunk::styling::{GREEN, HINT, HINT_EMOJI, SUCCESS_EMOJI};
+ use worktrunk::styling::{GREEN, SUCCESS_EMOJI};
let green_bold = GREEN.bold();
// Show where we ended up
@@ -309,7 +309,7 @@ fn format_merge_summary(primary_path: Option<&std::path::Path>) -> String {
path.display()
)
} else {
- format!("{HINT_EMOJI} {HINT}Use 'wt remove' to remove worktree{HINT:#}")
+ format!("{SUCCESS_EMOJI} {GREEN}Worktree preserved (--no-remove){GREEN:#}")
}
}
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 334fa99ac..6a598aa42 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -201,10 +201,23 @@ pub fn handle_switch(
// Create the worktree
// Build git worktree add command
let mut args = vec!["worktree", "add", worktree_path.to_str().unwrap()];
+
+ // Resolve the base branch if creating a new branch
+ let resolved_base = if create {
+ // Default to default branch if no base specified
+ match base {
+ Some(b) => Some(b.to_string()),
+ None => Some(repo.resolve_target_branch(None)?),
+ }
+ } else {
+ None
+ };
+
+ // Build args based on whether we're creating or checking out
if create {
args.push("-b");
args.push(branch);
- if let Some(base_branch) = base {
+ if let Some(ref base_branch) = resolved_base {
args.push(base_branch);
}
} else {
@@ -237,7 +250,7 @@ pub fn handle_switch(
Ok(SwitchResult::CreatedWorktree {
path: worktree_path,
created_branch: create,
- base_branch: base.map(String::from),
+ base_branch: resolved_base,
})
}
@@ -627,7 +640,8 @@ pub fn handle_push(
}
// Check for merge commits unless allowed
- if !allow_merge_commits && repo.has_merge_commits(&target_branch, "HEAD")? {
+ let has_merge_commits = repo.has_merge_commits(&target_branch, "HEAD")?;
+ if !allow_merge_commits && has_merge_commits {
return Err(GitError::MergeCommitsFound);
}
@@ -669,7 +683,10 @@ pub fn handle_push(
let cyan_dim = CYAN.dimmed();
- // Build parenthetical showing which operations didn't happen
+ // Build parenthetical showing which operations didn't happen and flags used
+ let mut notes = Vec::new();
+
+ // Skipped operations
let mut skipped_ops = Vec::new();
if !committed && !squashed {
// Neither commit nor squash happened - combine them
@@ -678,11 +695,19 @@ pub fn handle_push(
if !rebased {
skipped_ops.push("rebase");
}
+ if !skipped_ops.is_empty() {
+ notes.push(format!("no {} needed", skipped_ops.join("/")));
+ }
+
+ // Flag acknowledgments
+ if allow_merge_commits && has_merge_commits {
+ notes.push("merge commits allowed".to_string());
+ }
- let operations_note = if skipped_ops.is_empty() {
+ let operations_note = if notes.is_empty() {
String::new()
} else {
- format!(" (no {} needed)", skipped_ops.join("/"))
+ format!(" ({})", notes.join(", "))
};
crate::output::progress(format!(
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index 8f99d7f0d..4f431cdf1 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -228,12 +228,8 @@ fn test_configure_shell_multiple_configs() {
let repo = TestRepo::new();
let temp_home = TempDir::new().unwrap();
- // Create multiple shell config files (platform-aware for Bash)
- let bash_config_path = if cfg!(target_os = "macos") {
- temp_home.path().join(".bash_profile")
- } else {
- temp_home.path().join(".bashrc")
- };
+ // Create multiple shell config files
+ let bash_config_path = temp_home.path().join(".bash_profile");
let zshrc_path = temp_home.path().join(".zshrc");
fs::write(&bash_config_path, "# Existing bash config\n").unwrap();
fs::write(&zshrc_path, "# Existing zsh config\n").unwrap();
@@ -241,8 +237,6 @@ fn test_configure_shell_multiple_configs() {
let mut settings = Settings::clone_current();
settings.set_snapshot_path("../snapshots");
settings.add_filter(&temp_home.path().to_string_lossy(), "[TEMP_HOME]");
- // Normalize bash config file names across platforms
- settings.add_filter(r"\.bashrc", ".bash_profile");
settings.bind(|| {
let mut cmd = Command::new(get_cargo_bin("wt"));
@@ -291,11 +285,7 @@ fn test_configure_shell_mixed_states() {
let temp_home = TempDir::new().unwrap();
// Create bash config with wt already configured
- let bash_config_path = if cfg!(target_os = "macos") {
- temp_home.path().join(".bash_profile")
- } else {
- temp_home.path().join(".bashrc")
- };
+ let bash_config_path = temp_home.path().join(".bash_profile");
fs::write(
&bash_config_path,
"# Existing config\nif command -v wt >/dev/null 2>&1; then eval \"$(wt init bash)\"; fi\n",
@@ -309,8 +299,6 @@ fn test_configure_shell_mixed_states() {
let mut settings = Settings::clone_current();
settings.set_snapshot_path("../snapshots");
settings.add_filter(&temp_home.path().to_string_lossy(), "[TEMP_HOME]");
- // Normalize bash config file names across platforms
- settings.add_filter(r"\.bashrc", ".bash_profile");
settings.bind(|| {
let mut cmd = Command::new(get_cargo_bin("wt"));
diff --git a/tests/integration_tests/e2e_shell.rs b/tests/integration_tests/e2e_shell.rs
index b415f3ad7..276bb5fed 100644
--- a/tests/integration_tests/e2e_shell.rs
+++ b/tests/integration_tests/e2e_shell.rs
@@ -13,16 +13,6 @@ fn get_shell_binary(shell: &str) -> &str {
}
}
-/// Helper to check if a shell is available on the system
-fn is_shell_available(shell: &str) -> bool {
- let binary = get_shell_binary(shell);
- Command::new("which")
- .arg(binary)
- .output()
- .map(|o| o.status.success())
- .unwrap_or(false)
-}
-
/// Execute a shell script in the given shell and return stdout
fn execute_shell_script(repo: &TestRepo, shell: &str, script: &str) -> String {
let binary = get_shell_binary(shell);
@@ -208,11 +198,6 @@ fn test_e2e_remove_returns_to_main(#[case] shell: &str) {
#[test]
fn test_bash_e2e_switch_preserves_output() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -246,11 +231,6 @@ fn test_bash_e2e_switch_preserves_output() {
#[test]
fn test_bash_e2e_error_handling() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -282,11 +262,6 @@ fn test_bash_e2e_error_handling() {
#[test]
fn test_bash_e2e_switch_to_existing_worktree() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -320,11 +295,6 @@ fn test_bash_e2e_switch_to_existing_worktree() {
#[test]
fn test_bash_e2e_multiple_switches() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let mut repo = TestRepo::new();
repo.commit("Initial commit");
repo.setup_remote("main");
@@ -364,11 +334,6 @@ fn test_bash_e2e_multiple_switches() {
#[test]
fn test_bash_e2e_switch_linebreaks() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
diff --git a/tests/integration_tests/e2e_shell_post_start.rs b/tests/integration_tests/e2e_shell_post_start.rs
index 7aee36003..d96b715de 100644
--- a/tests/integration_tests/e2e_shell_post_start.rs
+++ b/tests/integration_tests/e2e_shell_post_start.rs
@@ -16,16 +16,6 @@ fn get_shell_binary(shell: &str) -> &str {
}
}
-/// Helper to check if a shell is available on the system
-fn is_shell_available(shell: &str) -> bool {
- let binary = get_shell_binary(shell);
- Command::new("which")
- .arg(binary)
- .output()
- .map(|o| o.status.success())
- .unwrap_or(false)
-}
-
/// Execute a shell script in the given shell and return stdout
fn execute_shell_script(repo: &TestRepo, shell: &str, script: &str) -> String {
let binary = get_shell_binary(shell);
@@ -242,11 +232,6 @@ approved-commands = ["sleep 0.5 && echo 'Background task done' > bg_marker.txt"]
/// Test that multiple post-start commands run in parallel with shell integration
#[test]
fn test_bash_post_start_multiple_parallel_commands() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -326,11 +311,6 @@ approved-commands = [
/// Test that post-create commands block before shell returns
#[test]
fn test_bash_post_create_blocks() {
- if !is_shell_available("bash") {
- eprintln!("Skipping test: bash not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
@@ -406,11 +386,6 @@ approved-commands = ["echo 'Setup done' > setup.txt"]
/// Test fish shell specifically with background tasks
#[test]
fn test_fish_post_start_background() {
- if !is_shell_available("fish") {
- eprintln!("Skipping test: fish not available");
- return;
- }
-
let repo = TestRepo::new();
repo.commit("Initial commit");
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index c82aa0c70..094017fef 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -5,6 +5,11 @@ use std::process::Command;
/// Helper to create snapshot with normalized paths and SHAs
fn snapshot_list(test_name: &str, repo: &TestRepo) {
+ snapshot_list_from_dir(test_name, repo, repo.root_path());
+}
+
+/// Helper to create snapshot with normalized paths and SHAs from a specific directory
+fn snapshot_list_from_dir(test_name: &str, repo: &TestRepo, cwd: &std::path::Path) {
let mut settings = Settings::clone_current();
settings.set_snapshot_path("../snapshots");
@@ -27,7 +32,7 @@ fn snapshot_list(test_name: &str, repo: &TestRepo) {
let mut cmd = Command::new(get_cargo_bin("wt"));
// Clean environment to avoid interference from global git config
repo.clean_cli_env(&mut cmd);
- cmd.arg("list").current_dir(repo.root_path());
+ cmd.arg("list").current_dir(cwd);
assert_cmd_snapshot!(test_name, cmd);
});
@@ -323,3 +328,117 @@ fn test_list_json_with_display_fields() {
snapshot_list_json("json_with_display_fields", &repo);
}
+
+#[test]
+fn test_list_ordering_rules() {
+ let mut repo = TestRepo::new();
+
+ // Create main with earliest timestamp (00:00)
+ repo.commit("Initial commit on main");
+
+ // Create worktrees in non-chronological order to prove we sort by timestamp
+
+ // 1. Create feature-current (01:00) - we'll run test from here
+ let current_path = repo.add_worktree("feature-current", "feature-current");
+ {
+ // Create commit with timestamp 01:00
+ let file_path = current_path.join("current.txt");
+ std::fs::write(&file_path, "current content").expect("Failed to write file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T01:00:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T01:00:00Z");
+ cmd.args(["add", "."])
+ .current_dir(&current_path)
+ .output()
+ .expect("Failed to git add");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T01:00:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T01:00:00Z");
+ cmd.args(["commit", "-m", "Commit at 01:00"])
+ .current_dir(&current_path)
+ .output()
+ .expect("Failed to git commit");
+ }
+
+ // 2. Create feature-newest (03:00) - most recent, should be 3rd
+ let newest_path = repo.add_worktree("feature-newest", "feature-newest");
+ {
+ let file_path = newest_path.join("newest.txt");
+ std::fs::write(&file_path, "newest content").expect("Failed to write file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T03:00:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T03:00:00Z");
+ cmd.args(["add", "."])
+ .current_dir(&newest_path)
+ .output()
+ .expect("Failed to git add");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T03:00:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T03:00:00Z");
+ cmd.args(["commit", "-m", "Commit at 03:00"])
+ .current_dir(&newest_path)
+ .output()
+ .expect("Failed to git commit");
+ }
+
+ // 3. Create feature-middle (02:00) - should be 4th
+ let middle_path = repo.add_worktree("feature-middle", "feature-middle");
+ {
+ let file_path = middle_path.join("middle.txt");
+ std::fs::write(&file_path, "middle content").expect("Failed to write file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T02:00:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T02:00:00Z");
+ cmd.args(["add", "."])
+ .current_dir(&middle_path)
+ .output()
+ .expect("Failed to git add");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T02:00:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T02:00:00Z");
+ cmd.args(["commit", "-m", "Commit at 02:00"])
+ .current_dir(&middle_path)
+ .output()
+ .expect("Failed to git commit");
+ }
+
+ // 4. Create feature-oldest (00:30) - should be 5th
+ let oldest_path = repo.add_worktree("feature-oldest", "feature-oldest");
+ {
+ let file_path = oldest_path.join("oldest.txt");
+ std::fs::write(&file_path, "oldest content").expect("Failed to write file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T00:30:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T00:30:00Z");
+ cmd.args(["add", "."])
+ .current_dir(&oldest_path)
+ .output()
+ .expect("Failed to git add");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.env("GIT_AUTHOR_DATE", "2025-01-01T00:30:00Z");
+ cmd.env("GIT_COMMITTER_DATE", "2025-01-01T00:30:00Z");
+ cmd.args(["commit", "-m", "Commit at 00:30"])
+ .current_dir(&oldest_path)
+ .output()
+ .expect("Failed to git commit");
+ }
+
+ // Run from feature-current worktree to test "current worktree" logic
+ snapshot_list_from_dir("list_ordering_rules", &repo, &current_path);
+}
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index 65928b6d3..ec98db44d 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -1799,17 +1799,14 @@ EOF
fs::write(bin_dir.join("llm"), llm_script).expect("Failed to write llm script");
// Make scripts executable
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- let mut perms = fs::metadata(bin_dir.join("cargo")).unwrap().permissions();
- perms.set_mode(0o755);
- fs::set_permissions(bin_dir.join("cargo"), perms).unwrap();
-
- let mut perms = fs::metadata(bin_dir.join("llm")).unwrap().permissions();
- perms.set_mode(0o755);
- fs::set_permissions(bin_dir.join("llm"), perms).unwrap();
- }
+ use std::os::unix::fs::PermissionsExt;
+ let mut perms = fs::metadata(bin_dir.join("cargo")).unwrap().permissions();
+ perms.set_mode(0o755);
+ fs::set_permissions(bin_dir.join("cargo"), perms).unwrap();
+
+ let mut perms = fs::metadata(bin_dir.join("llm")).unwrap().permissions();
+ perms.set_mode(0o755);
+ fs::set_permissions(bin_dir.join("llm"), perms).unwrap();
let config_content = r#"
[pre-merge-command]
@@ -1983,7 +1980,7 @@ fn test_merge_no_commit_with_clean_tree() {
1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
- πŸ’‘ Use 'wt remove' to remove worktree
+ βœ… Worktree preserved (--no-remove)
----- stderr -----
");
@@ -2090,7 +2087,7 @@ fn test_merge_no_commit_no_squash_no_remove_redundant() {
1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
- πŸ’‘ Use 'wt remove' to remove worktree
+ βœ… Worktree preserved (--no-remove)
----- stderr -----
");
diff --git a/tests/integration_tests/push.rs b/tests/integration_tests/push.rs
index 728429be2..c81f20393 100644
--- a/tests/integration_tests/push.rs
+++ b/tests/integration_tests/push.rs
@@ -298,6 +298,78 @@ fn test_push_error_with_merge_commits() {
);
}
+#[test]
+fn test_push_with_merge_commits_allowed() {
+ let mut repo = TestRepo::new();
+ repo.commit("Initial commit");
+ repo.setup_remote("main");
+
+ // Create feature branch
+ let feature_wt = repo.add_worktree("feature", "feature");
+ std::fs::write(feature_wt.join("file1.txt"), "content1").expect("Failed to write file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["add", "file1.txt"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to add file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["commit", "-m", "Commit 1"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to commit");
+
+ // Create another branch for merging
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["checkout", "-b", "temp"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to create temp branch");
+
+ std::fs::write(feature_wt.join("file2.txt"), "content2").expect("Failed to write file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["add", "file2.txt"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to add file");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["commit", "-m", "Commit 2"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to commit");
+
+ // Switch back to feature and merge temp (creating merge commit)
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["checkout", "feature"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to checkout feature");
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["merge", "temp", "--no-ff", "-m", "Merge temp"])
+ .current_dir(&feature_wt)
+ .output()
+ .expect("Failed to merge");
+
+ // Push to main with --allow-merge-commits (should succeed with acknowledgment)
+ snapshot_push(
+ "push_with_merge_commits_allowed",
+ &repo,
+ &["main", "--allow-merge-commits"],
+ Some(&feature_wt),
+ );
+}
+
#[test]
fn test_push_no_remote() {
let mut repo = TestRepo::new();
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
index bab1b2665..16d705970 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
@@ -1,5 +1,5 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for bash-test, changed directory to [TMPDIR]/test-repo.bash-test
+βœ… Created new worktree for bash-test from main, changed directory to [TMPDIR]/test-repo.bash-test
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
index 018a183a1..87f07ac7a 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
@@ -1,8 +1,8 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for fish-multiline, changed directory to [TMPDIR]/test-repo.fish-multiline
+βœ… Created new worktree for fish-multiline from main, changed directory to [TMPDIR]/test-repo.fish-multiline
πŸ”„ Executing (--execute):
  echo 'line 1'; echo 'line 2'; echo 'line 3'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
index da66de298..dfce837ea 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
@@ -1,5 +1,5 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for fish-minimal, changed directory to [TMPDIR]/test-repo.fish-minimal
+βœ… Created new worktree for fish-minimal from main, changed directory to [TMPDIR]/test-repo.fish-minimal
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
index c68f6d98a..e253c3456 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
@@ -1,7 +1,7 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for fish-bg, changed directory to [TMPDIR]/test-repo.fish-bg
+βœ… Created new worktree for fish-bg from main, changed directory to [TMPDIR]/test-repo.fish-bg
πŸ”„ Running post-start:
  echo 'fish background task'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
index fbd4cba69..2493b3fd9 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
@@ -1,5 +1,5 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for feature, changed directory to [TMPDIR]/test-repo.feature
+βœ… Created new worktree for feature from main, changed directory to [TMPDIR]/test-repo.feature
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
index a395b31cc..434f431d8 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
@@ -1,8 +1,8 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for test-exec, changed directory to [TMPDIR]/test-repo.test-exec
+βœ… Created new worktree for test-exec from main, changed directory to [TMPDIR]/test-repo.test-exec
πŸ”„ Executing (--execute):
  echo executed
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
index a395b31cc..434f431d8 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
@@ -1,8 +1,8 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for test-exec, changed directory to [TMPDIR]/test-repo.test-exec
+βœ… Created new worktree for test-exec from main, changed directory to [TMPDIR]/test-repo.test-exec
πŸ”„ Executing (--execute):
  echo executed
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_bash.snap
index 6647c48c7..cc6d34d4f 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_bash.snap
@@ -12,7 +12,7 @@ Installing dependencies...
Building project...
-βœ… Created new worktree for feature-hooks, changed directory to [TMPDIR]/test-repo.feature-hooks
+βœ… Created new worktree for feature-hooks from main, changed directory to [TMPDIR]/test-repo.feature-hooks
πŸ”„ Running post-start: server
  echo 'Starting dev server on port 3000'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
index a257429dc..3f048aa63 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
@@ -12,7 +12,7 @@ Building project...
  echo 'Building project...'
-βœ… Created new worktree for feature-hooks, changed directory to [TMPDIR]/test-repo.feature-hooks
+βœ… Created new worktree for feature-hooks from main, changed directory to [TMPDIR]/test-repo.feature-hooks
πŸ”„ Running post-start: server
  echo 'Starting dev server on port 3000'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
index 802612239..9306f4729 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
@@ -1,7 +1,7 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for feature-with-hooks, changed directory to [TMPDIR]/test-repo.feature-with-hooks
+βœ… Created new worktree for feature-with-hooks from main, changed directory to [TMPDIR]/test-repo.feature-with-hooks
πŸ”„ Running post-start:
  echo 'test command executed'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
index ca06a74a4..4089aad15 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
@@ -1,7 +1,7 @@
---
source: tests/integration_tests/shell_wrapper.rs
-expression: output.normalized().as_ref()
+expression: output.normalized()
---
-βœ… Created new worktree for feature-bg, changed directory to [TMPDIR]/test-repo.feature-bg
+βœ… Created new worktree for feature-bg from main, changed directory to [TMPDIR]/test-repo.feature-bg
πŸ”„ Running post-start:
  echo 'background task'
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 00d637e1e..4cf4ee45c 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -170,10 +170,7 @@ fn test_switch_internal_with_execute() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- #[cfg(not(target_os = "windows"))]
let execute_cmd = "echo 'line1'\necho 'line2'";
- #[cfg(target_os = "windows")]
- let execute_cmd = "echo line1 && echo line2";
snapshot_switch_with_global_flags(
"switch_internal_with_execute",
@@ -215,10 +212,6 @@ fn test_switch_execute_creates_file() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- // Use platform-specific command
- #[cfg(target_os = "windows")]
- let create_file_cmd = "echo test > test.txt";
- #[cfg(not(target_os = "windows"))]
let create_file_cmd = "echo 'test content' > test.txt";
snapshot_switch(
@@ -248,10 +241,6 @@ fn test_switch_execute_with_existing_worktree() {
// Create a worktree first
repo.add_worktree("existing-exec", "existing-exec");
- // Use platform-specific command
- #[cfg(target_os = "windows")]
- let create_file_cmd = "echo existing > existing.txt";
- #[cfg(not(target_os = "windows"))]
let create_file_cmd = "echo 'existing worktree' > existing.txt";
snapshot_switch(
@@ -266,10 +255,6 @@ fn test_switch_execute_multiline() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- // Test multi-line command execution
- #[cfg(target_os = "windows")]
- let multiline_cmd = "echo line1\r\necho line2\r\necho line3";
- #[cfg(not(target_os = "windows"))]
let multiline_cmd = "echo 'line1'\necho 'line2'\necho 'line3'";
snapshot_switch(
@@ -310,9 +295,6 @@ fn test_switch_no_config_commands_skips_post_start_commands() {
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).expect("Failed to create .config dir");
- #[cfg(target_os = "windows")]
- let create_file_cmd = "echo marker > marker.txt";
- #[cfg(not(target_os = "windows"))]
let create_file_cmd = "echo 'marker' > marker.txt";
fs::write(
@@ -404,8 +386,8 @@ fn test_switch_no_config_commands_with_force() {
fn test_switch_create_no_remote() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- // Deliberately NOT calling setup_remote to test the error case
+ // Deliberately NOT calling setup_remote to test local branch inference
- // Try to create a branch without specifying base (should fail - no remote to get default branch)
+ // Create a branch without specifying base - should infer default branch locally
snapshot_switch("switch_create_no_remote", &repo, &["--create", "feature"]);
}
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap
index f222217d3..4f1f83817 100644
Binary files a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap and b/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap differ
diff --git a/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap b/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
index bd44b18e6..a61fa7542 100644
--- a/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
+++ b/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/e2e_shell.rs
expression: output
---
-βœ… Created new worktree for test-branch, changed directory to [REPO].test-branch
+βœ… Created new worktree for test-branch from main, changed directory to [REPO].test-branch
MARKER
diff --git a/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snap b/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snap
new file mode 100644
index 000000000..54b4d8b97
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snap
@@ -0,0 +1,32 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp9tgp6m/test-config.toml
+---
+success: true
+exit_code: 0
+----- stdout -----
+Branch Main ↕ Path Commit Age Message
+main  ./test-repo  6c3da842 10 months ago Initial commit on main
+feature-current ↑1 ./feature-current fc28a4d1 9 months ago  Commit at 01:00
+feature-newest ↑1 ./feature-newest 136358eb 9 months ago  Commit at 03:00
+feature-middle ↑1 ./feature-middle a0a4851a 9 months ago  Commit at 02:00
+feature-oldest ↑1 ./feature-oldest 1b1a2d78 9 months ago  Commit at 00:30
+
+Showing 5 worktrees, 4 ahead
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
index b3ef0a31e..3d2142782 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpAQALRW/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0Mbv83/test-config.toml
---
success: true
exit_code: 0
@@ -30,6 +30,6 @@ exit_code: 0
1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
-πŸ’‘ Use 'wt remove' to remove worktree
+βœ… Worktree preserved (--no-remove)
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
index 3b75ebebe..2819c2533 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpwtELB2/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfPABXP/test-config.toml
---
success: true
exit_code: 0
@@ -25,7 +25,7 @@ exit_code: 0
πŸ”„ Running post-create:
  echo 'Setup done' > setup.txt
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start: server
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
index 73a838180..58a251dfa 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
@@ -19,12 +19,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpw7qRQi/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpow16S6/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
πŸ”„ Running post-start:
  echo 'Background task' > background.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
index 7fd0a6933..25116e595 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpSL8cIi/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpbVUckX/test-config.toml
---
success: true
exit_code: 0
@@ -26,7 +26,7 @@ exit_code: 0
  exit 1
🟑 Command failed: Command failed with exit code: exit status: 1
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
index 574b70aa1..b3e486deb 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmplIcGuI/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpGomvbk/test-config.toml
---
success: true
exit_code: 0
@@ -29,7 +29,7 @@ exit_code: 0
  echo 'File exists' > result.txt
  fi
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
index 7ffbcc7be..a609d18ab 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpxAvMPj/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpqTsQ2h/test-config.toml
---
success: true
exit_code: 0
@@ -28,7 +28,7 @@ exit_code: 0
πŸ”„ Running post-create: 2
  echo 'Second'
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
index d1ba3662e..415238dc3 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp8lRZ3O/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpuEduRe/test-config.toml
---
success: true
exit_code: 0
@@ -28,7 +28,7 @@ exit_code: 0
πŸ”„ Running post-create: setup
  echo 'Running setup'
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
index b48b9c246..72dd7fa86 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmphz6CGY/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpIWafH6/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
index a2d8bc425..3c72d3e71 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpRpNChz/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpMygpNC/test-config.toml
---
success: true
exit_code: 0
@@ -25,7 +25,7 @@ exit_code: 0
πŸ”„ Running post-create:
  echo 'Setup complete'
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
index 3c4cb98a3..ed55d9c9a 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp6fXivq/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpI8VcDn/test-config.toml
---
success: true
exit_code: 0
@@ -34,7 +34,7 @@ exit_code: 0
πŸ”„ Running post-create: 4
  echo 'Root: [REPO]' >> info.txt
-βœ… Created new worktree for feature/test at [REPO].feature-test
+βœ… Created new worktree for feature/test from main at [REPO].feature-test
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
index ef4ffb3f8..6180ae5a5 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp25Nkm3/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpwGr01s/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start:
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
index b96da2846..065fc61a4 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5JT9gN/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjzxv7d/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start:
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
index cf4fe32c8..bcc633a2c 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXVkh1r/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp8vrnQV/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start:
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
index 0352b2960..2800aee09 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpwdZsCL/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpmf1z5e/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start:
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
index 4d7cab9d4..18a217fd4 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp8d3NOn/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpEq21zW/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start:
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
index 8e3b0f92b..4881ec643 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpv4ZXzM/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp84mbUD/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start: task1
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
index cb7b9ef23..4b1ac6bc4 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpdSOELg/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpnnRuGJ/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start: task1
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
index 8c229e939..9460fd36a 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkM68la/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUHhLco/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
πŸ”„ Running post-start:
diff --git a/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap b/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap
new file mode 100644
index 000000000..476a175c9
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap
@@ -0,0 +1,40 @@
+---
+source: tests/integration_tests/push.rs
+info:
+ program: wt
+ args:
+ - dev
+ - push
+ - main
+ - "--allow-merge-commits"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpTA9M28/test-config.toml
+---
+success: true
+exit_code: 0
+----- stdout -----
+πŸ”„ Pushing 3 commits to main @ [SHA] (no commit/squash/rebase needed, merge commits allowed)
+
+* [SHA] (HEAD -> feature) Merge temp
+|/
+| * [SHA] (temp) Commit 2
+|/
+* [SHA] Commit 1
+
+ file1.txt | 1 +
+ file2.txt | 1 +
+ 2 files changed, 2 insertions(+)
+
+βœ… Pushed to main (3 commits, 2 files, +2)
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
index 5aa3ee796..ec44cb322 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLcOi1H/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpbplgS6/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature-x at [REPO].feature-x
+βœ… Created new worktree for feature-x from main at [REPO].feature-x
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap
index cda624f8b..503b68352 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpN8OOYG/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp03JkRb/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for feature at [REPO].feature
+βœ… Created new worktree for feature from main at [REPO].feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap
index 23fefb7cf..31f25f5c9 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap
@@ -17,12 +17,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp3qx2vn/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmprdFhoF/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for remote-feature at [REPO].remote-feature
+βœ… Created new worktree for remote-feature from main at [REPO].remote-feature
To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
index 70dd97307..cc43fe45d 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
@@ -19,12 +19,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpw6rxax/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpiWgyEm/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for file-test at [REPO].file-test
+βœ… Created new worktree for file-test from main at [REPO].file-test
πŸ”„ Executing (--execute):
  echo 'test content' > test.txt
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
index f0b85e164..3c3c844a8 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
@@ -19,12 +19,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkHCs5N/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpMYplGI/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-βœ… Created new worktree for fail-test at [REPO].fail-test
+βœ… Created new worktree for fail-test from main at [REPO].fail-test
πŸ”„ Executing (--execute):
  exit 1
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
index 7956ea2d0..7440e24b4 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
@@ -19,12 +19,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp876Zh0/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUlhmRk/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for multiline-test at [REPO].multiline-test
+βœ… Created new worktree for multiline-test from main at [REPO].multiline-test
πŸ”„ Executing (--execute):
  echo 'line1'
  echo 'line2'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
index e711b4779..38e9c1b7c 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
@@ -19,12 +19,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpWx2lRL/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpTQuy9K/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-βœ… Created new worktree for exec-test at [REPO].exec-test
+βœ… Created new worktree for exec-test from main at [REPO].exec-test
πŸ”„ Executing (--execute):
  echo 'test output'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
index 18cfb80cf..8057d17a7 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
index 4c96dcf74..4389ca9b5 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap differ