Skip to content

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

refactor: rename get_* functions to bare nouns (#1586)

worktrunk-bot1afa9c230b6a
diff --git a/.cargo/config.toml b/.cargo/config.toml
index badb950bb..610878786 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,5 +1,5 @@
# Set terminal width for deterministic test output.
-# Unit tests call get_terminal_width() in-process and need this env var.
+# Unit tests call terminal_width() in-process and need this env var.
# Integration tests override with COLUMNS=150 in their command setup.
[env]
COLUMNS = "80"
diff --git a/benches/list.rs b/benches/list.rs
index a0e05dc1e..4801ac609 100644
--- a/benches/list.rs
+++ b/benches/list.rs
@@ -63,7 +63,7 @@ impl BenchConfig {
}
}
-fn get_release_binary() -> &'static Path {
+fn release_binary() -> &'static Path {
Path::new(env!("CARGO_BIN_EXE_wt"))
}
@@ -102,7 +102,7 @@ fn run_benchmark(
fn bench_skeleton(c: &mut Criterion) {
let mut group = c.benchmark_group("skeleton");
- let binary = get_release_binary();
+ let binary = release_binary();
for worktrees in [1, 4, 8] {
for cold in [false, true] {
@@ -133,7 +133,7 @@ fn bench_skeleton(c: &mut Criterion) {
fn bench_complete(c: &mut Criterion) {
let mut group = c.benchmark_group("complete");
- let binary = get_release_binary();
+ let binary = release_binary();
for worktrees in [1, 4, 8] {
for cold in [false, true] {
@@ -157,7 +157,7 @@ fn bench_complete(c: &mut Criterion) {
fn bench_worktree_scaling(c: &mut Criterion) {
let mut group = c.benchmark_group("worktree_scaling");
- let binary = get_release_binary();
+ let binary = release_binary();
for worktrees in [1, 4, 8] {
for cold in [false, true] {
@@ -181,7 +181,7 @@ fn bench_worktree_scaling(c: &mut Criterion) {
fn bench_real_repo(c: &mut Criterion) {
let mut group = c.benchmark_group("real_repo");
- let binary = get_release_binary();
+ let binary = release_binary();
for worktrees in [1, 4, 8] {
for cold in [false, true] {
@@ -228,7 +228,7 @@ fn bench_real_repo(c: &mut Criterion) {
fn bench_many_branches(c: &mut Criterion) {
let mut group = c.benchmark_group("many_branches");
- let binary = get_release_binary();
+ let binary = release_binary();
for cold in [false, true] {
let config = BenchConfig::branches(100, 2, cold);
@@ -256,7 +256,7 @@ fn bench_divergent_branches(c: &mut Criterion) {
group.measurement_time(std::time::Duration::from_secs(30));
group.sample_size(10);
- let binary = get_release_binary();
+ let binary = release_binary();
for cold in [false, true] {
let config = BenchConfig::many_divergent_branches(cold);
@@ -307,7 +307,7 @@ fn bench_real_repo_many_branches(c: &mut Criterion) {
group.measurement_time(std::time::Duration::from_secs(60));
group.sample_size(10);
- let binary = get_release_binary();
+ let binary = release_binary();
// Setup function - each bench_function creates its own fresh workspace
// Uses setup_rust_workspace_with_branches plus a worktree for worktrees_only test
diff --git a/benches/time_to_first_output.rs b/benches/time_to_first_output.rs
index 00ecf0166..02b098414 100644
--- a/benches/time_to_first_output.rs
+++ b/benches/time_to_first_output.rs
@@ -18,7 +18,7 @@ use std::path::Path;
use std::process::Command;
use wt_perf::{RepoConfig, create_repo, setup_fake_remote};
-fn get_release_binary() -> &'static Path {
+fn release_binary() -> &'static Path {
Path::new(env!("CARGO_BIN_EXE_wt"))
}
@@ -34,7 +34,7 @@ fn run_bench_cmd(cmd: &mut Command) {
fn bench_first_output(c: &mut Criterion) {
let mut group = c.benchmark_group("first_output");
- let binary = get_release_binary();
+ let binary = release_binary();
let env = ("WORKTRUNK_FIRST_OUTPUT", "1");
let config = RepoConfig::typical(4);
diff --git a/src/commands/config/mod.rs b/src/commands/config/mod.rs
index e613b47cc..5c0e129be 100644
--- a/src/commands/config/mod.rs
+++ b/src/commands/config/mod.rs
@@ -200,13 +200,13 @@ mod tests {
}
#[test]
- fn test_require_user_config_path_matches_get_config_path() {
+ fn test_require_user_config_path_matches_config_path() {
// Verify that config create/show path matches config loading path.
// This was the root cause of #1134: the two paths diverged on Windows
// when XDG_CONFIG_HOME was set because config create had its own
// XDG/HOME resolution that differed from config loading.
let create_path = require_user_config_path().unwrap();
- let load_path = worktrunk::config::get_config_path().unwrap();
+ let load_path = worktrunk::config::config_path().unwrap();
assert_eq!(
create_path, load_path,
"config create path and config loading path must be identical"
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index 7b229b4f4..834dcf328 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -11,7 +11,7 @@ use anyhow::Context;
use color_print::cformat;
use worktrunk::config::{
ProjectConfig, UserConfig, default_system_config_path, find_unknown_project_keys,
- find_unknown_user_keys, get_system_config_path,
+ find_unknown_user_keys, system_config_path,
};
use worktrunk::git::Repository;
use worktrunk::path::format_path_for_display;
@@ -25,7 +25,7 @@ use worktrunk::styling::{
use super::state::require_user_config_path;
use crate::cli::version_str;
use crate::commands::configure_shell::{ConfigAction, scan_shell_configs};
-use crate::commands::list::ci_status::{CiPlatform, CiToolsStatus, get_platform_for_repo};
+use crate::commands::list::ci_status::{CiPlatform, CiToolsStatus, platform_for_repo};
use crate::help_pager::show_help_in_pager;
use crate::llm::test_commit_generation;
use crate::output;
@@ -88,7 +88,7 @@ fn is_claude_available() -> bool {
}
/// Get the home directory for Claude Code config detection
-fn get_home_dir() -> Option<PathBuf> {
+fn home_dir() -> Option<PathBuf> {
// Try HOME/USERPROFILE env vars first (for tests and explicit overrides), then fall back to dirs
std::env::var("HOME")
.or_else(|_| std::env::var("USERPROFILE"))
@@ -99,7 +99,7 @@ fn get_home_dir() -> Option<PathBuf> {
/// Check if the worktrunk plugin is installed in Claude Code
fn is_plugin_installed() -> bool {
- let Some(home) = get_home_dir() else {
+ let Some(home) = home_dir() else {
return false;
};
@@ -114,7 +114,7 @@ fn is_plugin_installed() -> bool {
/// Check if the statusline is configured in Claude Code settings
fn is_statusline_configured() -> bool {
- let Some(home) = get_home_dir() else {
+ let Some(home) = home_dir() else {
return false;
};
@@ -131,7 +131,7 @@ fn is_statusline_configured() -> bool {
}
/// Get the git version string (e.g., "2.47.1")
-fn get_git_version() -> Option<String> {
+fn git_version() -> Option<String> {
let output = Cmd::new("git").arg("--version").run().ok()?;
if !output.status.success() {
return None;
@@ -240,7 +240,7 @@ fn render_runtime_info(out: &mut String) -> anyhow::Result<()> {
"{}",
info_message(cformat!("{cmd}: <bold>{version}</>"))
)?;
- if let Some(git_version) = get_git_version() {
+ if let Some(git_version) = git_version() {
writeln!(
out,
"{}",
@@ -273,7 +273,7 @@ fn render_diagnostics(out: &mut String) -> anyhow::Result<()> {
let repo = Repository::current()?;
let project_config = repo.load_project_config().ok().flatten();
let platform_override = project_config.as_ref().and_then(|c| c.ci_platform());
- let platform = get_platform_for_repo(&repo, platform_override, None);
+ let platform = platform_for_repo(&repo, platform_override, None);
match platform {
Some(CiPlatform::GitHub) => {
@@ -349,7 +349,7 @@ fn render_diagnostics(out: &mut String) -> anyhow::Result<()> {
/// Render the SYSTEM CONFIG section. Returns true if a system config file was found.
fn render_system_config(out: &mut String) -> anyhow::Result<bool> {
- let Some(system_path) = get_system_config_path() else {
+ let Some(system_path) = system_config_path() else {
return Ok(false);
};
@@ -1130,7 +1130,7 @@ mod tests {
#[test]
fn test_get_git_version_returns_version() {
// In a normal environment with git installed, should return a version
- let version = get_git_version();
+ let version = git_version();
assert!(version.is_some());
let version = version.unwrap();
// Version should look like a semver (e.g., "2.47.1")
diff --git a/src/commands/config/state.rs b/src/commands/config/state.rs
index f23debda2..3d1e98da7 100644
--- a/src/commands/config/state.rs
+++ b/src/commands/config/state.rs
@@ -8,7 +8,7 @@ use std::path::PathBuf;
use anyhow::Context;
use color_print::cformat;
-use worktrunk::config::get_config_path;
+use worktrunk::config::config_path;
use worktrunk::git::Repository;
use worktrunk::path::{format_path_for_display, sanitize_for_filename};
use worktrunk::styling::{
@@ -18,7 +18,7 @@ use worktrunk::styling::{
use crate::cli::OutputFormat;
use crate::commands::process::HookLog;
-use worktrunk::utils::get_now;
+use worktrunk::utils::epoch_now;
use super::super::list::ci_status::{CachedCiStatus, CiBranchName};
use crate::display::format_relative_time_short;
@@ -28,11 +28,11 @@ use crate::help_pager::show_help_in_pager;
/// Get the user config path, or error if it cannot be determined.
///
-/// Delegates to `get_config_path()` so that `config create` and `config show`
+/// Delegates to `config_path()` so that `config create` and `config show`
/// resolve the same path that config loading uses — including any CLI
/// (`--config`) or environment variable (`WORKTRUNK_CONFIG_PATH`) overrides.
pub fn require_user_config_path() -> anyhow::Result<PathBuf> {
- get_config_path().context("Cannot determine config directory")
+ config_path().context("Cannot determine config directory")
}
// ==================== Log Management ====================
@@ -396,7 +396,7 @@ pub fn handle_state_set(key: &str, value: String, branch: Option<String>) -> any
};
// Store as JSON with timestamp
- let now = get_now();
+ let now = epoch_now();
let json = serde_json::json!({
"marker": value,
"set_at": now
@@ -628,7 +628,7 @@ fn handle_state_show_json(repo: &Repository) -> anyhow::Result<()> {
let previous_branch = repo.switch_previous();
// Get markers
- let markers: Vec<serde_json::Value> = get_all_markers(repo)
+ let markers: Vec<serde_json::Value> = all_markers(repo)
.into_iter()
.map(|m| {
serde_json::json!({
@@ -753,7 +753,7 @@ fn handle_state_show_table(repo: &Repository) -> anyhow::Result<()> {
// Show branch markers
writeln!(out, "{}", format_heading("BRANCH MARKERS", None))?;
- let markers = get_all_markers(repo);
+ let markers = all_markers(repo);
if markers.is_empty() {
writeln!(out, "{}", format_with_gutter("(none)", None))?;
} else {
@@ -844,7 +844,7 @@ pub(super) struct MarkerEntry {
}
/// Get all branch markers from git config with timestamps
-pub(super) fn get_all_markers(repo: &Repository) -> Vec<MarkerEntry> {
+pub(super) fn all_markers(repo: &Repository) -> Vec<MarkerEntry> {
let output = repo
.run_command(&["config", "--get-regexp", r"^worktrunk\.state\..+\.marker$"])
.unwrap_or_default();
diff --git a/src/commands/config/update.rs b/src/commands/config/update.rs
index e45a67190..f37929a09 100644
--- a/src/commands/config/update.rs
+++ b/src/commands/config/update.rs
@@ -7,7 +7,7 @@ use std::path::PathBuf;
use anyhow::Context;
use worktrunk::config::{
- DeprecationInfo, format_deprecation_warnings, format_migration_diff, get_config_path,
+ DeprecationInfo, config_path, format_deprecation_warnings, format_migration_diff,
};
use worktrunk::git::Repository;
use worktrunk::styling::{
@@ -100,7 +100,7 @@ fn format_update_preview(info: &DeprecationInfo) -> String {
/// Check user config for deprecations and generate .new file if needed.
fn check_user_config() -> anyhow::Result<Option<UpdateCandidate>> {
- let config_path = match get_config_path() {
+ let config_path = match config_path() {
Some(path) => path,
None => return Ok(None),
};
diff --git a/src/commands/handle_switch.rs b/src/commands/handle_switch.rs
index 3f081e05e..0c80c4564 100644
--- a/src/commands/handle_switch.rs
+++ b/src/commands/handle_switch.rs
@@ -13,7 +13,7 @@ use super::command_approval::approve_hooks;
use super::command_executor::{CommandContext, build_hook_context};
use super::hooks::{HookFailureStrategy, execute_hook};
use super::worktree::{
- SwitchBranchInfo, SwitchPlan, SwitchResult, execute_switch, get_path_mismatch, plan_switch,
+ SwitchBranchInfo, SwitchPlan, SwitchResult, execute_switch, path_mismatch, plan_switch,
};
use crate::output::{
execute_user_command, handle_switch_output, is_shell_integration_active,
@@ -241,7 +241,7 @@ pub fn handle_switch(
// Compute path mismatch lazily (deferred from plan_switch for existing worktrees)
let branch_info = match &result {
SwitchResult::Existing { path } | SwitchResult::AlreadyAt(path) => {
- let expected_path = get_path_mismatch(&repo, &branch_info.branch, path, config);
+ let expected_path = path_mismatch(&repo, &branch_info.branch, path, config);
SwitchBranchInfo {
expected_path,
..branch_info
diff --git a/src/commands/hook_commands.rs b/src/commands/hook_commands.rs
index 736e88141..99c5b9805 100644
--- a/src/commands/hook_commands.rs
+++ b/src/commands/hook_commands.rs
@@ -438,7 +438,7 @@ fn render_user_hooks(
filter: Option<HookType>,
ctx: Option<&CommandContext>,
) -> anyhow::Result<()> {
- let config_path = worktrunk::config::get_config_path();
+ let config_path = worktrunk::config::config_path();
writeln!(
out,
diff --git a/src/commands/list/ci_status/github.rs b/src/commands/list/ci_status/github.rs
index cdf8110da..dd0e40016 100644
--- a/src/commands/list/ci_status/github.rs
+++ b/src/commands/list/ci_status/github.rs
@@ -14,7 +14,7 @@ use super::{
///
/// Used for GitHub API calls that require `repos/{owner}/{repo}/...` paths.
/// Searches all remotes for a GitHub URL (API calls are repo-wide, not branch-specific).
-fn get_github_owner_repo(repo: &Repository) -> Option<(String, String)> {
+fn github_owner_repo(repo: &Repository) -> Option<(String, String)> {
for (_, url) in repo.all_remote_urls() {
if let Some(parsed) = GitRemoteUrl::parse(&url)
&& parsed.is_github()
@@ -166,7 +166,7 @@ pub(super) fn detect_github(
/// status across multiple workflows (e.g., `ci` and `publish-docs`).
pub(super) fn detect_github_commit_checks(repo: &Repository, local_head: &str) -> Option<PrStatus> {
let repo_root = repo.current_worktree().root().ok()?;
- let (owner, repo_name) = get_github_owner_repo(repo)?;
+ let (owner, repo_name) = github_owner_repo(repo)?;
// Use GitHub's check-runs API to get all checks for this commit
let output = match non_interactive_cmd("gh")
diff --git a/src/commands/list/ci_status/gitlab.rs b/src/commands/list/ci_status/gitlab.rs
index 69dee6e53..f8bac536b 100644
--- a/src/commands/list/ci_status/gitlab.rs
+++ b/src/commands/list/ci_status/gitlab.rs
@@ -30,7 +30,7 @@ use super::{
///
/// Returns None if glab is not configured for this repo (e.g., non-GitLab
/// remote, auth issues).
-fn get_gitlab_project_id(repo: &Repository) -> Option<u64> {
+fn gitlab_project_id(repo: &Repository) -> Option<u64> {
let repo_root = repo.current_worktree().root().ok()?;
// Use glab repo view to get the project info as JSON
@@ -76,7 +76,7 @@ pub(super) fn detect_gitlab(
let repo_root = repo.current_worktree().root().ok()?;
// Get current project ID for filtering
- let project_id = get_gitlab_project_id(repo);
+ let project_id = gitlab_project_id(repo);
if project_id.is_none() {
log::debug!("Could not determine GitLab project ID");
}
diff --git a/src/commands/list/ci_status/mod.rs b/src/commands/list/ci_status/mod.rs
index 638141ef8..0ed0be9f5 100644
--- a/src/commands/list/ci_status/mod.rs
+++ b/src/commands/list/ci_status/mod.rs
@@ -13,7 +13,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use worktrunk::git::Repository;
use worktrunk::shell_exec::Cmd;
-use worktrunk::utils::get_now;
+use worktrunk::utils::epoch_now;
/// A parsed branch name for CI status detection.
///
@@ -100,7 +100,7 @@ impl CiBranchName {
// Re-export public types
pub(crate) use cache::CachedCiStatus;
-pub use platform::{CiPlatform, get_platform_for_repo};
+pub use platform::{CiPlatform, platform_for_repo};
/// Maximum number of PRs/MRs to fetch when filtering by source repository.
///
@@ -349,7 +349,7 @@ impl PrStatus {
// Check cache first to avoid hitting API rate limits
// Use full_name as cache key to distinguish local "feature" from remote "origin/feature"
- let now_secs = get_now();
+ let now_secs = epoch_now();
if let Some(cached) = CachedCiStatus::read(repo, &branch.full_name) {
if cached.is_valid(local_head, now_secs, &repo_path) {
@@ -404,7 +404,7 @@ impl PrStatus {
// Determine platform (config override, branch's remote, or any remote URL)
// For remote branches, use their specific remote to get the correct platform
- let platform = get_platform_for_repo(repo, platform_override, branch.remote.as_deref());
+ let platform = platform_for_repo(repo, platform_override, branch.remote.as_deref());
match platform {
Some(p) => p.detect_ci(repo, branch, local_head, has_upstream),
diff --git a/src/commands/list/ci_status/platform.rs b/src/commands/list/ci_status/platform.rs
index e652fc06e..74d8d6197 100644
--- a/src/commands/list/ci_status/platform.rs
+++ b/src/commands/list/ci_status/platform.rs
@@ -123,7 +123,7 @@ pub fn detect_platform_from_url(url: &str) -> Option<CiPlatform> {
///
/// For remote branches, pass the branch's remote as `remote_hint` to ensure
/// the correct platform is detected in mixed-remote repos (e.g., GitHub + GitLab).
-pub fn get_platform_for_repo(
+pub fn platform_for_repo(
repo: &Repository,
platform_override: Option<&str>,
remote_hint: Option<&str>,
diff --git a/src/commands/list/collect/mod.rs b/src/commands/list/collect/mod.rs
index ecd82548c..755fd1c8e 100644
--- a/src/commands/list/collect/mod.rs
+++ b/src/commands/list/collect/mod.rs
@@ -569,7 +569,7 @@ pub fn collect(
);
// Single-line invariant: use safe width to prevent line wrapping
- let max_width = crate::display::get_terminal_width();
+ let max_width = crate::display::terminal_width();
// Create collection options from skip set
let returned_skip_tasks = effective_skip_tasks.clone();
diff --git a/src/commands/list/collect/tasks.rs b/src/commands/list/collect/tasks.rs
index 7d79e6f62..78b4e3141 100644
--- a/src/commands/list/collect/tasks.rs
+++ b/src/commands/list/collect/tasks.rs
@@ -163,7 +163,7 @@ impl Task for AheadBehindTask {
// Cache lookup has minor overhead (rev-parse for cache key + allocations),
// but saves the expensive ahead_behind computation on cache hit.
let (ahead, behind) = if let Some(branch) = ctx.branch_ref.branch.as_deref() {
- if let Some(counts) = repo.get_cached_ahead_behind(&base, branch) {
+ if let Some(counts) = repo.cached_ahead_behind(&base, branch) {
counts
} else {
repo.ahead_behind(&base, &ctx.branch_ref.commit_sha)
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rs
index 6b63d70f3..d799f705e 100644
--- a/src/commands/list/layout.rs
+++ b/src/commands/list/layout.rs
@@ -184,7 +184,7 @@ use anstyle::Style;
use unicode_width::UnicodeWidthStr;
use worktrunk::styling::{ADDITION, DELETION, Stream, supports_hyperlinks};
-use crate::display::{get_terminal_width, shorten_path};
+use crate::display::{shorten_path, terminal_width};
use super::collect::{TaskKind, parse_port_from_url};
use super::columns::{COLUMN_SPECS, ColumnKind, ColumnSpec, column_display_index};
@@ -869,7 +869,7 @@ pub fn calculate_layout_from_basics(
calculate_layout_with_width(
items,
skip_tasks,
- get_terminal_width(),
+ terminal_width(),
main_worktree_path,
url_template,
)
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index dab88a230..da74c3f95 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -12,8 +12,8 @@ use super::hooks::{HookFailureStrategy, execute_hook};
use super::project_config::{ApprovableCommand, collect_commands_for_hooks};
use super::repository_ext::RepositoryCliExt;
use super::worktree::{
- BranchDeletionMode, MergeOperations, RemoveResult, get_path_mismatch, handle_no_ff_merge,
- handle_push,
+ BranchDeletionMode, MergeOperations, RemoveResult, handle_no_ff_merge, handle_push,
+ path_mismatch,
};
/// Options for the merge command
@@ -255,7 +255,7 @@ pub fn handle_merge(opts: MergeOptions<'_>) -> anyhow::Result<()> {
// After a successful merge, get integration reason
let (_, integration_reason) = repo.integration_reason(&current_branch, &target_branch)?;
// Compute expected_path for path mismatch detection
- let expected_path = get_path_mismatch(repo, &current_branch, &worktree_root, config);
+ let expected_path = path_mismatch(repo, &current_branch, &worktree_root, config);
// Capture commit SHA before removal for post-remove hook template variables
let removed_commit = current_wt
.run_command(&["rev-parse", "HEAD"])
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index 34207e998..1e7f16692 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -79,7 +79,7 @@ pub(crate) fn format_command_label(command_type: &str, name: Option<&str>) -> St
/// * `repo` - The repository to query
/// * `range` - The commit range to diff (e.g., "HEAD~1..HEAD" or "main..HEAD")
pub(crate) fn show_diffstat(repo: &worktrunk::git::Repository, range: &str) -> anyhow::Result<()> {
- let term_width = crate::display::get_terminal_width();
+ let term_width = crate::display::terminal_width();
let stat_width = term_width.saturating_sub(worktrunk::styling::GUTTER_OVERHEAD);
let diff_stat = repo
.run_command(&[
diff --git a/src/commands/process.rs b/src/commands/process.rs
index b5428e17a..d22ca1533 100644
--- a/src/commands/process.rs
+++ b/src/commands/process.rs
@@ -9,7 +9,7 @@ use std::str::FromStr;
use strum::IntoEnumIterator;
use worktrunk::git::{HookType, Repository};
use worktrunk::path::{format_path_for_display, sanitize_for_filename};
-use worktrunk::utils::get_now;
+use worktrunk::utils::epoch_now;
use crate::commands::hook_filter::HookSource;
@@ -378,7 +378,7 @@ fn spawn_detached_windows(
///
/// Format: `<path>.wt-removing-<timestamp>`
pub fn generate_removing_path(worktree_path: &Path) -> PathBuf {
- let timestamp = get_now();
+ let timestamp = epoch_now();
let name = worktree_path
.file_name()
.map(|n| n.to_string_lossy())
diff --git a/src/commands/relocate.rs b/src/commands/relocate.rs
index b46348391..2c18b5594 100644
--- a/src/commands/relocate.rs
+++ b/src/commands/relocate.rs
@@ -326,7 +326,7 @@ impl RelocationExecutor {
if clobber {
// Backup the blocker
- let timestamp_secs = worktrunk::utils::get_now() as i64;
+ let timestamp_secs = worktrunk::utils::epoch_now() as i64;
let datetime = chrono::DateTime::from_timestamp(timestamp_secs, 0)
.unwrap_or_else(chrono::Utc::now);
let suffix = datetime.format("%Y%m%d-%H%M%S");
diff --git a/src/commands/repository_ext.rs b/src/commands/repository_ext.rs
index 44d0eb206..ffe1b7efa 100644
--- a/src/commands/repository_ext.rs
+++ b/src/commands/repository_ext.rs
@@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
use std::process;
use std::time::{SystemTime, UNIX_EPOCH};
-use super::worktree::{BranchDeletionMode, RemoveResult, get_path_mismatch};
+use super::worktree::{BranchDeletionMode, RemoveResult, path_mismatch};
use anyhow::{Context, bail};
use color_print::cformat;
use worktrunk::config::UserConfig;
@@ -253,7 +253,7 @@ impl RepositoryCliExt for Repository {
// Only set if actual path differs from expected (path mismatch)
let expected_path = branch_name
.as_ref()
- .and_then(|branch| get_path_mismatch(self, branch, &worktree_path, config));
+ .and_then(|branch| path_mismatch(self, branch, &worktree_path, config));
// Capture commit SHA before removal for post-remove hook template variables.
// This ensures {{ commit }} references the removed worktree's state.
diff --git a/src/commands/select/items.rs b/src/commands/select/items.rs
index 9b6cd4cb5..202866b40 100644
--- a/src/commands/select/items.rs
+++ b/src/commands/select/items.rs
@@ -17,7 +17,7 @@ use super::super::list::model::ListItem;
use super::log_formatter::{
FIELD_DELIM, batch_fetch_stats, format_log_output, process_log_with_dimming, strip_hash_markers,
};
-use super::pager::{get_diff_pager, pipe_through_pager};
+use super::pager::{diff_pager, pipe_through_pager};
use super::preview::{PreviewMode, PreviewStateData};
/// Cache key for pre-computed previews: (branch_name, mode).
@@ -172,7 +172,7 @@ impl WorktreeSkimItem {
match mode {
PreviewMode::Summary => super::summary::render_summary(&content, width),
PreviewMode::WorkingTree | PreviewMode::BranchDiff | PreviewMode::UpstreamDiff => {
- if let Some(pager_cmd) = get_diff_pager() {
+ if let Some(pager_cmd) = diff_pager() {
pipe_through_pager(&content, pager_cmd, width)
} else {
content
diff --git a/src/commands/select/mod.rs b/src/commands/select/mod.rs
index 777ee32cc..447a31220 100644
--- a/src/commands/select/mod.rs
+++ b/src/commands/select/mod.rs
@@ -22,7 +22,7 @@ use super::handle_switch::{
};
use super::list::collect;
use super::worktree::{
- SwitchBranchInfo, SwitchResult, execute_switch, get_path_mismatch, handle_remove, plan_switch,
+ SwitchBranchInfo, SwitchResult, execute_switch, handle_remove, path_mismatch, plan_switch,
};
use crate::output::{handle_remove_output, handle_switch_output};
@@ -97,7 +97,7 @@ pub fn handle_select(
// List width depends on preview position:
// - Right layout: skim splits ~50% for list, ~50% for preview
// - Down layout: list gets full width, preview is below
- let terminal_width = crate::display::get_terminal_width();
+ let terminal_width = crate::display::terminal_width();
let skim_list_width = match state.initial_layout {
PreviewLayout::Right => terminal_width / 2,
PreviewLayout::Down => terminal_width,
@@ -395,8 +395,7 @@ pub fn handle_select(
// Compute path mismatch lazily (deferred from plan_switch for existing worktrees)
let branch_info = match &result {
SwitchResult::Existing { path } | SwitchResult::AlreadyAt(path) => {
- let expected_path =
- get_path_mismatch(&repo, &branch_info.branch, path, config);
+ let expected_path = path_mismatch(&repo, &branch_info.branch, path, config);
SwitchBranchInfo {
expected_path,
..branch_info
diff --git a/src/commands/select/pager.rs b/src/commands/select/pager.rs
index 70c925b0c..ca5687a78 100644
--- a/src/commands/select/pager.rs
+++ b/src/commands/select/pager.rs
@@ -45,7 +45,7 @@ fn needs_paging_disabled(pager_cmd: &str) -> bool {
/// 2. `[select] pager` in user config (deprecated, used as-is)
/// 3. `GIT_PAGER` environment variable (auto-detection applied)
/// 4. `core.pager` git config (auto-detection applied)
-pub(super) fn get_diff_pager() -> Option<&'static String> {
+pub(super) fn diff_pager() -> Option<&'static String> {
CACHED_PAGER
.get_or_init(|| {
// Check user config first - use exactly as specified (no auto-detection)
@@ -195,7 +195,7 @@ mod tests {
fn test_get_diff_pager_initializes() {
// Exercise the config initialization path
// Returns None or Some depending on user's pager config
- let _ = get_diff_pager();
+ let _ = diff_pager();
}
#[test]
diff --git a/src/commands/statusline.rs b/src/commands/statusline.rs
index f1676c387..4516c3d6e 100644
--- a/src/commands/statusline.rs
+++ b/src/commands/statusline.rs
@@ -15,7 +15,7 @@ use dunce::canonicalize;
use ansi_str::AnsiStr;
use anyhow::{Context, Result};
use worktrunk::git::Repository;
-use worktrunk::styling::{fix_dim_after_color_reset, get_terminal_width, truncate_visible};
+use worktrunk::styling::{fix_dim_after_color_reset, terminal_width, truncate_visible};
use super::list::{self, CollectOptions, StatuslineSegment, json_output};
use crate::cli::OutputFormat;
@@ -201,7 +201,7 @@ pub fn run(format: OutputFormat) -> Result<()> {
if let Ok(repo) = Repository::current()
&& repo.worktree_at(&cwd).git_dir().is_ok()
{
- let git_segments = get_git_status_segments(&repo, &cwd, !claude_code)?;
+ let git_segments = git_status_segments(&repo, &cwd, !claude_code)?;
// In claude-code mode, skip branch segment if directory matches worktrunk template
let git_segments = if let Some(ref dir) = dir_str {
@@ -232,7 +232,7 @@ pub fn run(format: OutputFormat) -> Result<()> {
}
// Fit segments to terminal width using priority-based dropping
- let max_width = get_terminal_width();
+ let max_width = terminal_width();
// Reserve 1 char for leading space (ellipsis handled by truncate_visible fallback)
let content_budget = max_width.saturating_sub(1);
let fitted_segments = StatuslineSegment::fit_to_width(segments, content_budget);
@@ -339,7 +339,7 @@ fn filter_redundant_branch(segments: Vec<StatuslineSegment>, dir: &str) -> Vec<S
/// Get git status as prioritized segments for the current worktree.
///
/// When `include_links` is true, CI status includes clickable OSC 8 hyperlinks.
-fn get_git_status_segments(
+fn git_status_segments(
repo: &Repository,
cwd: &Path,
include_links: bool,
diff --git a/src/commands/step_commands.rs b/src/commands/step_commands.rs
index e441d5edd..6f17e1ec1 100644
--- a/src/commands/step_commands.rs
+++ b/src/commands/step_commands.rs
@@ -1339,7 +1339,7 @@ pub fn step_prune(dry_run: bool, yes: bool, min_age: &str, foreground: bool) ->
let worktrees = repo.list_worktrees()?;
let current_root = repo.current_worktree().root()?.to_path_buf();
let current_root = dunce::canonicalize(&current_root).unwrap_or(current_root);
- let now_secs = worktrunk::utils::get_now();
+ let now_secs = worktrunk::utils::epoch_now();
let default_branch = repo.default_branch();
diff --git a/src/commands/worktree/mod.rs b/src/commands/worktree/mod.rs
index b5769a002..6083105e2 100644
--- a/src/commands/worktree/mod.rs
+++ b/src/commands/worktree/mod.rs
@@ -90,7 +90,7 @@ pub use push::{handle_no_ff_merge, handle_push};
pub use remove::{handle_remove, handle_remove_current};
pub(crate) use resolve::paths_match;
pub use resolve::{
- compute_worktree_path, get_path_mismatch, is_worktree_at_expected_path, resolve_worktree_arg,
+ compute_worktree_path, is_worktree_at_expected_path, path_mismatch, resolve_worktree_arg,
worktree_display_name,
};
pub use switch::{execute_switch, plan_switch};
diff --git a/src/commands/worktree/resolve.rs b/src/commands/worktree/resolve.rs
index 05cd7a5c7..66561bd2d 100644
--- a/src/commands/worktree/resolve.rs
+++ b/src/commands/worktree/resolve.rs
@@ -188,7 +188,7 @@ pub(crate) fn paths_match(a: &std::path::Path, b: &std::path::Path) -> bool {
///
/// Returns `Some(expected_path)` when there's a mismatch, `None` when paths match.
/// Used to show path mismatch warnings in switch, select, remove, and merge.
-pub fn get_path_mismatch(
+pub fn path_mismatch(
repo: &Repository,
branch: &str,
actual_path: &std::path::Path,
@@ -274,7 +274,7 @@ pub(super) fn compute_clobber_backup(
}
if clobber {
- let timestamp = worktrunk::utils::get_now() as i64;
+ let timestamp = worktrunk::utils::epoch_now() as i64;
let datetime =
chrono::DateTime::from_timestamp(timestamp, 0).unwrap_or_else(chrono::Utc::now);
let suffix = datetime.format("%Y%m%d-%H%M%S").to_string();
diff --git a/src/config/approvals.rs b/src/config/approvals.rs
index 87cd03a38..94f0c0552 100644
--- a/src/config/approvals.rs
+++ b/src/config/approvals.rs
@@ -56,7 +56,7 @@ struct ApprovedProject {
/// 1. `WORKTRUNK_APPROVALS_PATH` environment variable
/// 2. In test builds: panic if env var not set
/// 3. Production: sibling of config.toml (`approvals.toml` in same directory)
-pub fn get_approvals_path() -> Option<PathBuf> {
+pub fn approvals_path() -> Option<PathBuf> {
if let Ok(path) = std::env::var("WORKTRUNK_APPROVALS_PATH") {
return Some(PathBuf::from(path));
}
@@ -69,7 +69,7 @@ pub fn get_approvals_path() -> Option<PathBuf> {
#[cfg(not(test))]
{
- super::user::get_config_path().map(|p| p.with_file_name("approvals.toml"))
+ super::user::config_path().map(|p| p.with_file_name("approvals.toml"))
}
}
@@ -89,7 +89,7 @@ impl Approvals {
/// source of truth. Users can clean up stale `approved-commands` in config.toml
/// at their convenience.
pub fn load() -> Result<Self, ConfigError> {
- let Some(path) = get_approvals_path() else {
+ let Some(path) = approvals_path() else {
return Ok(Self::default());
};
@@ -131,7 +131,7 @@ impl Approvals {
/// 3. If neither exists → return empty
///
/// The fallback uses sibling derivation (`path.with_file_name("config.toml")`)
- /// which is correct because `get_approvals_path()` derives approvals.toml as
+ /// which is correct because `approvals_path()` derives approvals.toml as
/// a sibling of config.toml.
fn load_with_fallback(path: &Path) -> Result<Self, ConfigError> {
if path.exists() {
@@ -241,7 +241,7 @@ impl Approvals {
{
let path = match approvals_path {
Some(p) => p.to_path_buf(),
- None => get_approvals_path().ok_or_else(|| {
+ None => self::approvals_path().ok_or_else(|| {
ConfigError::Message(
"Cannot determine approvals path. Set $HOME or $XDG_CONFIG_HOME".to_string(),
)
diff --git a/src/config/mod.rs b/src/config/mod.rs
index d7d73cd1b..c2fb38e42 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -71,7 +71,7 @@ impl WorktrunkConfig for ProjectConfig {
}
// Re-export public types
-pub use approvals::{Approvals, get_approvals_path};
+pub use approvals::{Approvals, approvals_path};
pub use commands::{Command, CommandConfig};
pub use deprecation::DeprecationInfo;
pub use deprecation::Deprecations;
@@ -96,9 +96,8 @@ pub use project::{
pub use user::{
CommitConfig, CommitGenerationConfig, ListConfig, MergeConfig, OverridableConfig,
ResolvedConfig, SelectConfig, StageMode, SwitchConfig, SwitchPickerConfig, UserConfig,
- UserProjectOverrides, default_config_path, default_system_config_path,
- find_unknown_keys as find_unknown_user_keys, get_config_path, get_system_config_path,
- set_config_path,
+ UserProjectOverrides, config_path, default_config_path, default_system_config_path,
+ find_unknown_keys as find_unknown_user_keys, set_config_path, system_config_path,
};
#[cfg(test)]
diff --git a/src/config/user/mod.rs b/src/config/user/mod.rs
index ecc5d579c..0aadf7e37 100644
--- a/src/config/user/mod.rs
+++ b/src/config/user/mod.rs
@@ -20,8 +20,8 @@ use serde::{Deserialize, Serialize};
// Re-export public types
pub use merge::Merge;
pub use path::{
- default_config_path, default_system_config_path, get_config_path, get_system_config_path,
- set_config_path,
+ config_path, default_config_path, default_system_config_path, set_config_path,
+ system_config_path,
};
pub use resolved::ResolvedConfig;
pub use schema::{find_unknown_keys, valid_user_config_keys};
@@ -123,7 +123,7 @@ impl UserConfig {
let mut builder = Config::builder();
// Add system config if it exists (lowest priority file source)
- if let Some(system_path) = path::get_system_config_path() {
+ if let Some(system_path) = path::system_config_path() {
if let Ok(content) = std::fs::read_to_string(&system_path) {
// Warn about unknown fields in system config
let unknown_keys: std::collections::HashMap<_, _> = find_unknown_keys(&content)
@@ -142,7 +142,7 @@ impl UserConfig {
}
// Add user config file if it exists (overrides system config)
- let config_path = get_config_path();
+ let config_path = config_path();
if let Some(config_path) = config_path.as_ref()
&& config_path.exists()
{
diff --git a/src/config/user/mutation.rs b/src/config/user/mutation.rs
index 02773d727..c6598d3f4 100644
--- a/src/config/user/mutation.rs
+++ b/src/config/user/mutation.rs
@@ -9,7 +9,7 @@ use fs2::FileExt;
use crate::path::format_path_for_display;
use super::UserConfig;
-use super::path::get_config_path;
+use super::path;
use super::sections::CommitConfig;
use super::sections::CommitGenerationConfig;
@@ -56,7 +56,7 @@ impl UserConfig {
{
let path = match config_path {
Some(p) => p.to_path_buf(),
- None => get_config_path().ok_or_else(|| {
+ None => path::config_path().ok_or_else(|| {
ConfigError::Message(
"Cannot determine config directory. Set $HOME or $XDG_CONFIG_HOME".to_string(),
)
@@ -82,7 +82,7 @@ impl UserConfig {
) -> Result<(), ConfigError> {
let path = match config_path {
Some(p) => Some(p.to_path_buf()),
- None => get_config_path(),
+ None => path::config_path(),
};
let Some(path) = path else {
diff --git a/src/config/user/path.rs b/src/config/user/path.rs
index 83d55e2a0..0cd0101b0 100644
--- a/src/config/user/path.rs
+++ b/src/config/user/path.rs
@@ -31,7 +31,7 @@ pub fn is_config_path_explicit() -> bool {
/// 1. CLI --config flag (set via `set_config_path`)
/// 2. WORKTRUNK_CONFIG_PATH environment variable
/// 3. Platform-specific default location (via `default_config_path`)
-pub fn get_config_path() -> Option<PathBuf> {
+pub fn config_path() -> Option<PathBuf> {
// Priority 1: CLI --config flag
if let Some(path) = CONFIG_PATH.get() {
return Some(path.clone());
@@ -48,7 +48,7 @@ pub fn get_config_path() -> Option<PathBuf> {
/// Platform-specific default config path, without CLI or env var overrides.
///
-/// Returns the etcetera-based platform default. Called by `get_config_path()`
+/// Returns the etcetera-based platform default. Called by `config_path()`
/// as the final fallback when no CLI or env var override is set.
///
///
@@ -73,7 +73,7 @@ pub fn default_config_path() -> Option<PathBuf> {
/// - Linux: /etc/xdg/worktrunk/config.toml (XDG default)
/// - macOS: /Library/Application Support/worktrunk/config.toml
/// - Windows: %PROGRAMDATA%\worktrunk\config.toml
-pub fn get_system_config_path() -> Option<PathBuf> {
+pub fn system_config_path() -> Option<PathBuf> {
// Priority 1: Explicit environment variable override
if let Ok(path) = std::env::var("WORKTRUNK_SYSTEM_CONFIG_PATH") {
let path = PathBuf::from(path);
@@ -99,7 +99,7 @@ pub fn get_system_config_path() -> Option<PathBuf> {
/// The expected system config path for the current platform.
///
/// Used by `wt config show` to display where to put a system config file.
-/// Mirrors the lookup order in `get_system_config_path()` so the displayed
+/// Mirrors the lookup order in `system_config_path()` so the displayed
/// path matches where the tool actually looks.
pub fn default_system_config_path() -> Option<PathBuf> {
if let Ok(path) = std::env::var("WORKTRUNK_SYSTEM_CONFIG_PATH") {
diff --git a/src/config/user/persistence.rs b/src/config/user/persistence.rs
index 6b391053c..db212544e 100644
--- a/src/config/user/persistence.rs
+++ b/src/config/user/persistence.rs
@@ -7,7 +7,7 @@ use config::ConfigError;
use serde::Serialize;
use super::UserConfig;
-use super::path::get_config_path;
+use super::path;
use super::sections::CommitGenerationConfig;
impl UserConfig {
@@ -24,7 +24,7 @@ impl UserConfig {
match config_path {
Some(path) => self.save_to(path),
None => {
- let path = get_config_path().ok_or_else(|| {
+ let path = path::config_path().ok_or_else(|| {
ConfigError::Message(
"Cannot determine config directory. Set $HOME or $XDG_CONFIG_HOME environment variable".to_string(),
)
diff --git a/src/config/user/tests.rs b/src/config/user/tests.rs
index cdb7a6fb4..68793ffb8 100644
--- a/src/config/user/tests.rs
+++ b/src/config/user/tests.rs
@@ -39,15 +39,15 @@ fn test_default_config_path_returns_platform_path() {
}
#[test]
-fn test_get_config_path_falls_through_to_default() {
+fn test_config_path_falls_through_to_default() {
// When no CLI override or WORKTRUNK_CONFIG_PATH env var is set,
- // get_config_path() should fall through to default_config_path().
+ // config_path() should fall through to default_config_path().
// This also verifies both functions return the same path.
let default = default_config_path().unwrap();
- let resolved = get_config_path().unwrap();
+ let resolved = config_path().unwrap();
assert_eq!(
resolved, default,
- "get_config_path() should match default_config_path() when no overrides are set"
+ "config_path() should match default_config_path() when no overrides are set"
);
}
diff --git a/src/diagnostic.rs b/src/diagnostic.rs
index a7096d420..c00c711de 100644
--- a/src/diagnostic.rs
+++ b/src/diagnostic.rs
@@ -133,7 +133,7 @@ impl DiagnosticReport {
let version = version_str();
let os = std::env::consts::OS;
let arch = std::env::consts::ARCH;
- let git_version = get_git_version().unwrap_or_else(|_| "(unknown)".to_string());
+ let git_version = git_version().unwrap_or_else(|_| "(unknown)".to_string());
let shell_integration = if output::is_shell_integration_active() {
"active"
} else {
@@ -145,7 +145,7 @@ impl DiagnosticReport {
.unwrap_or_else(|_| "(failed to get worktree list)".to_string());
// Get config show output (if available)
- let config_show = get_config_show_output(repo);
+ let config_show = config_show_output(repo);
// Get verbose log content (if available)
let verbose_log = crate::verbose_log::log_file_path()
@@ -295,7 +295,7 @@ fn truncate_log(content: &str) -> String {
}
/// Get git version string.
-fn get_git_version() -> anyhow::Result<String> {
+fn git_version() -> anyhow::Result<String> {
let output = Cmd::new("git")
.arg("--version")
.run()
@@ -314,11 +314,11 @@ fn get_git_version() -> anyhow::Result<String> {
/// Get config show output for diagnostic.
///
/// Returns a summary of user and project config files.
-fn get_config_show_output(repo: &Repository) -> Option<String> {
+fn config_show_output(repo: &Repository) -> Option<String> {
let mut output = String::new();
// User config
- if let Some(user_config_path) = worktrunk::config::get_config_path() {
+ if let Some(user_config_path) = worktrunk::config::config_path() {
output.push_str(&format_config_section(&user_config_path, "User config"));
}
diff --git a/src/display.rs b/src/display.rs
index f9226263e..8f5f52a9a 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -11,12 +11,12 @@ use std::path::{Component, Path};
use unicode_width::UnicodeWidthChar;
use worktrunk::path::format_path_for_display;
use worktrunk::styling::visual_width;
-use worktrunk::utils::get_now;
+use worktrunk::utils::epoch_now;
/// Format timestamp as abbreviated relative time (e.g., "2h")
pub(crate) fn format_relative_time_short(timestamp: i64) -> String {
// Cast to i64 for signed arithmetic (handles future timestamps)
- format_relative_time_impl(timestamp, get_now() as i64)
+ format_relative_time_impl(timestamp, epoch_now() as i64)
}
fn format_relative_time_impl(timestamp: i64, now: i64) -> String {
@@ -113,7 +113,7 @@ pub(crate) fn truncate_to_width(text: &str, max_width: usize) -> String {
}
// Re-export from styling for convenience
-pub(crate) use worktrunk::styling::{get_terminal_width, truncate_visible};
+pub(crate) use worktrunk::styling::{terminal_width, truncate_visible};
#[cfg(test)]
mod tests {
@@ -285,7 +285,7 @@ mod tests {
#[test]
fn test_format_relative_time_short_public() {
- // Test the public function (uses get_now internally)
+ // Test the public function (uses epoch_now internally)
let result = format_relative_time_short(0);
// A timestamp of 0 (Unix epoch) should show years ago
assert!(
@@ -296,11 +296,11 @@ mod tests {
}
#[test]
- fn test_get_now() {
- // get_now should return a reasonable timestamp
- let now = get_now();
+ fn test_epoch_now() {
+ // epoch_now should return a reasonable timestamp
+ let now = epoch_now();
// Should be after 2020 (1577836800)
- assert!(now > 1577836800, "get_now() should return current time");
+ assert!(now > 1577836800, "epoch_now() should return current time");
}
#[test]
diff --git a/src/git/remote_ref/gitlab.rs b/src/git/remote_ref/gitlab.rs
index 8f8fafad5..022a4f7bc 100644
--- a/src/git/remote_ref/gitlab.rs
+++ b/src/git/remote_ref/gitlab.rs
@@ -239,7 +239,7 @@ pub fn fetch_gitlab_project_urls(
})?;
// Compute URLs based on protocol preference
- let use_ssh = get_git_protocol() == "ssh";
+ let use_ssh = git_protocol() == "ssh";
let fork_push_url = if use_ssh {
source_ssh.or(source_http)
} else {
@@ -279,7 +279,7 @@ fn fetch_project_urls(
}
/// Get the git protocol configured in `glab` (GitLab CLI).
-pub fn get_git_protocol() -> String {
+pub fn git_protocol() -> String {
Cmd::new("glab")
.args(["config", "get", "git_protocol"])
.run()
diff --git a/src/git/repository/config.rs b/src/git/repository/config.rs
index 911738fa9..b71dedbc2 100644
--- a/src/git/repository/config.rs
+++ b/src/git/repository/config.rs
@@ -9,7 +9,7 @@ use super::{DefaultBranchName, GitError, Repository};
impl Repository {
/// Get a git config value. Returns None if the key doesn't exist.
- pub fn get_config(&self, key: &str) -> anyhow::Result<Option<String>> {
+ pub fn config_value(&self, key: &str) -> anyhow::Result<Option<String>> {
match self.run_command(&["config", key]) {
Ok(value) => Ok(Some(value.trim().to_string())),
Err(_) => Ok(None), // Config key doesn't exist
@@ -214,7 +214,7 @@ impl Repository {
let remote = self.primary_remote().ok()?;
// Try git's local cache for this remote (e.g., origin/HEAD)
- if let Ok(branch) = self.get_local_default_branch(&remote) {
+ if let Ok(branch) = self.local_default_branch(&remote) {
return Some(branch);
}
@@ -339,7 +339,7 @@ impl Repository {
&& self.all_branches().is_ok_and(|b| b.is_empty())
}
- fn get_local_default_branch(&self, remote: &str) -> anyhow::Result<String> {
+ fn local_default_branch(&self, remote: &str) -> anyhow::Result<String> {
let stdout =
self.run_command(&["rev-parse", "--abbrev-ref", &format!("{}/HEAD", remote)])?;
DefaultBranchName::from_local(remote, &stdout).map(DefaultBranchName::into_string)
diff --git a/src/git/repository/diff.rs b/src/git/repository/diff.rs
index 0f7add7bf..b725695e1 100644
--- a/src/git/repository/diff.rs
+++ b/src/git/repository/diff.rs
@@ -229,7 +229,7 @@ impl Repository {
/// Uses `git for-each-ref --format='%(ahead-behind:BASE)'` (git 2.36+) to get
/// all counts in a single command. Returns a map from branch name to (ahead, behind).
///
- /// Results are cached so subsequent lookups via `get_cached_ahead_behind()` avoid
+ /// Results are cached so subsequent lookups via `cached_ahead_behind()` avoid
/// running individual git commands (though cache access still has minor overhead).
///
/// On git < 2.36 or if the command fails, returns an empty map.
@@ -271,7 +271,7 @@ impl Repository {
///
/// Returns cached results from a prior `batch_ahead_behind()` call, or None
/// if the branch wasn't in the batch or batch wasn't run.
- pub fn get_cached_ahead_behind(&self, base: &str, branch: &str) -> Option<(usize, usize)> {
+ pub fn cached_ahead_behind(&self, base: &str, branch: &str) -> Option<(usize, usize)> {
self.cache
.ahead_behind
.get(&(base.to_string(), branch.to_string()))
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index df243d818..11b4d4875 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -125,7 +125,7 @@ pub(super) struct RepoCache {
/// Merge-base cache: (commit1, commit2) -> merge_base_sha (None = no common ancestor)
pub(super) merge_base: DashMap<(String, String), Option<String>>,
/// Batch ahead/behind cache: (base_ref, branch_name) -> (ahead, behind)
- /// Populated by batch_ahead_behind(), used by get_cached_ahead_behind()
+ /// Populated by batch_ahead_behind(), used by cached_ahead_behind()
pub(super) ahead_behind: DashMap<(String, String), (usize, usize)>,
// ========== Per-worktree values (keyed by path) ==========
diff --git a/src/help.rs b/src/help.rs
index 0646af53e..f2624eeda 100644
--- a/src/help.rs
+++ b/src/help.rs
@@ -133,7 +133,7 @@ pub fn maybe_handle_help_with_pager() -> bool {
// Render markdown sections (tables, code blocks, prose) with proper wrapping.
// Since we disabled clap's wrapping above, our renderer controls all line breaks.
- let width = worktrunk::styling::get_terminal_width();
+ let width = worktrunk::styling::terminal_width();
let help = crate::md_help::render_markdown_in_help_with_width(
&clap_output,
Some(width),
@@ -168,15 +168,15 @@ pub fn maybe_handle_help_with_pager() -> bool {
/// Returns the usage/options/subcommands section without the after_long_help content.
/// If `width` is provided, wraps text at that width (for web docs); otherwise uses default.
/// Always preserves ANSI color codes for HTML conversion.
-fn get_help_reference(command_path: &[&str], width: Option<usize>) -> String {
- let output = get_help_reference_inner(command_path, width);
+fn help_reference(command_path: &[&str], width: Option<usize>) -> String {
+ let output = help_reference_inner(command_path, width);
// Strip OSC 8 hyperlinks. Clap generates these from markdown links like [text](url),
// but web docs convert ANSI to HTML via ansi_to_html which only handles SGR codes
// (colors), not OSC sequences - hyperlinks leak through as garbage.
worktrunk::styling::strip_osc8_hyperlinks(&output)
}
-fn get_help_reference_inner(command_path: &[&str], width: Option<usize>) -> String {
+fn help_reference_inner(command_path: &[&str], width: Option<usize>) -> String {
// Build args: ["wt", "config", "create", "--help"]
let mut args: Vec<String> = vec!["wt".to_string()];
args.extend(command_path.iter().map(|s| s.to_string()));
@@ -381,7 +381,7 @@ Commands with pages: merge, switch, remove, list"
};
// Get the help reference block (wrap at 80 chars for web docs, with colors for HTML)
- let reference_block = get_help_reference(&[subcommand], Some(80));
+ let reference_block = help_reference(&[subcommand], Some(80));
// Output the generated content (frontmatter is in skeleton files)
// Uses region markers so sync can replace just this content
@@ -608,7 +608,7 @@ fn format_subcommand_section(
.collect();
// Get help reference (wrap at 80 chars for web docs, with colors for HTML)
- let reference_block = get_help_reference(&command_path, Some(80));
+ let reference_block = help_reference(&command_path, Some(80));
// Format the section: heading, main content, command reference, then nested subdocs
let mut section = format!("## {full_command}{heading_badge}\n\n");
diff --git a/src/output/global.rs b/src/output/global.rs
index 670ea7cba..9a5d010bc 100644
--- a/src/output/global.rs
+++ b/src/output/global.rs
@@ -162,7 +162,7 @@ impl SymlinkMapping {
/// this translates canonical paths back to the symlink tree. Returns the original path unchanged
/// if no symlink mapping exists or the translation doesn't round-trip correctly.
pub fn to_logical_path(path: &Path) -> PathBuf {
- let guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");
+ let guard = state().lock().expect("OUTPUT_STATE lock poisoned");
let Some(mapping) = &guard.symlink_mapping else {
return path.to_path_buf();
};
@@ -176,7 +176,7 @@ pub fn to_logical_path(path: &Path) -> PathBuf {
///
/// Reads `WORKTRUNK_DIRECTIVE_FILE` from environment on first access.
/// Empty or whitespace-only strings are treated as "not set" to handle edge cases.
-fn get_state() -> &'static Mutex<OutputState> {
+fn state() -> &'static Mutex<OutputState> {
OUTPUT_STATE.get_or_init(|| {
let directive_file = std::env::var(DIRECTIVE_FILE_ENV_VAR)
.ok()
@@ -196,7 +196,7 @@ fn get_state() -> &'static Mutex<OutputState> {
/// Check if shell integration is active (directive file is set)
fn has_directive_file() -> bool {
- get_state()
+ state()
.lock()
.expect("OUTPUT_STATE lock poisoned")
.directive_file
@@ -207,7 +207,7 @@ fn has_directive_file() -> bool {
fn write_directive(directive: &str) -> io::Result<()> {
// Copy path out of lock to avoid holding mutex during I/O
let path = {
- let guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");
+ let guard = state().lock().expect("OUTPUT_STATE lock poisoned");
guard.directive_file.clone()
};
@@ -226,7 +226,7 @@ fn write_directive(directive: &str) -> io::Result<()> {
/// Also stores path for execute() to use as working directory.
pub fn change_directory(path: impl AsRef<Path>) -> io::Result<()> {
let path = path.as_ref();
- let mut guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");
+ let mut guard = state().lock().expect("OUTPUT_STATE lock poisoned");
// Store for execute() to use as process cwd
guard.target_dir = Some(path.to_path_buf());
@@ -261,7 +261,7 @@ pub fn change_directory(path: impl AsRef<Path>) -> io::Result<()> {
/// process CWD was part of the worktree being removed. The error handler in
/// `main.rs` checks this to show a "directory was removed" hint.
pub fn mark_cwd_removed() {
- get_state()
+ state()
.lock()
.expect("OUTPUT_STATE lock poisoned")
.cwd_removed = true;
@@ -269,7 +269,7 @@ pub fn mark_cwd_removed() {
/// Check whether the CWD worktree was removed during this command.
pub fn was_cwd_removed() -> bool {
- get_state()
+ state()
.lock()
.expect("OUTPUT_STATE lock poisoned")
.cwd_removed
@@ -283,7 +283,7 @@ pub fn execute(command: impl Into<String>) -> anyhow::Result<()> {
let command = command.into();
let (has_directive, target_dir) = {
- let guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");
+ let guard = state().lock().expect("OUTPUT_STATE lock poisoned");
(guard.directive_file.is_some(), guard.target_dir.clone())
};
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index d10d65a39..a8a94a1fd 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -302,7 +302,7 @@ impl FlagNote {
/// Get flag acknowledgment note for remove messages
///
/// `target_branch`: The branch we checked integration against (shown in reason)
-fn get_flag_note(
+fn flag_note(
deletion_mode: BranchDeletionMode,
outcome: &BranchDeletionOutcome,
target_branch: Option<&str>,
@@ -738,7 +738,7 @@ fn handle_branch_only_output(
);
}
} else {
- let flag_note = get_flag_note(
+ let flag_note = flag_note(
deletion_mode,
&deletion.outcome,
Some(&deletion.integration_target),
@@ -941,7 +941,7 @@ impl RemovalDisplayInfo {
/// Print the removal message (progress for background, success for foreground).
fn print_message(&self, branch_name: &str, foreground: bool) -> anyhow::Result<()> {
- let flag_note = get_flag_note(
+ let flag_note = flag_note(
if self.branch_deleted() {
BranchDeletionMode::SafeDelete // Doesn't matter, outcome already determined
} else {
@@ -1378,9 +1378,9 @@ mod tests {
}
#[test]
- fn test_get_flag_note() {
+ fn test_flag_note() {
// --no-delete-branch flag (text only, no symbol, no suffix)
- let note = get_flag_note(
+ let note = flag_note(
BranchDeletionMode::Keep,
&BranchDeletionOutcome::NotDeleted,
None,
@@ -1390,7 +1390,7 @@ mod tests {
assert!(note.suffix.is_empty());
// NotDeleted without flag (empty)
- let note = get_flag_note(
+ let note = flag_note(
BranchDeletionMode::SafeDelete,
&BranchDeletionOutcome::NotDeleted,
None,
@@ -1400,7 +1400,7 @@ mod tests {
assert!(note.suffix.is_empty());
// Force deleted (text only, no symbol, no suffix)
- let note = get_flag_note(
+ let note = flag_note(
BranchDeletionMode::ForceDelete,
&BranchDeletionOutcome::ForceDeleted,
None,
@@ -1418,7 +1418,7 @@ mod tests {
(IntegrationReason::MergeAddsNothing, "all changes in"),
];
for (reason, expected_desc) in cases {
- let note = get_flag_note(
+ let note = flag_note(
BranchDeletionMode::SafeDelete,
&BranchDeletionOutcome::Integrated(reason),
Some("main"),
diff --git a/src/shell_exec.rs b/src/shell_exec.rs
index 8c918b0b1..cb0c9e78f 100644
--- a/src/shell_exec.rs
+++ b/src/shell_exec.rs
@@ -54,7 +54,7 @@ fn max_concurrent_commands() -> usize {
.unwrap_or(DEFAULT_CONCURRENT_COMMANDS)
}
-fn get_semaphore() -> &'static Semaphore {
+fn semaphore() -> &'static Semaphore {
CMD_SEMAPHORE.get_or_init(|| Semaphore::new(max_concurrent_commands()))
}
@@ -574,7 +574,7 @@ impl Cmd {
}
// Acquire semaphore to limit concurrent commands
- let _guard = get_semaphore().acquire();
+ let _guard = semaphore().acquire();
// Capture timing for tracing
let t0 = Instant::now();
diff --git a/src/styling/format.rs b/src/styling/format.rs
index 68b200ab4..4e9cb3f02 100644
--- a/src/styling/format.rs
+++ b/src/styling/format.rs
@@ -8,7 +8,7 @@ use super::highlighting::bash_token_style;
use tree_sitter_highlight::{HighlightConfiguration, HighlightEvent, Highlighter};
// Import canonical implementations from parent module
-use super::{get_terminal_width, visual_width};
+use super::{terminal_width, visual_width};
/// Width overhead added by format_with_gutter()
///
@@ -114,7 +114,7 @@ pub fn format_with_gutter(content: &str, max_width: Option<usize>) -> String {
let gutter = super::GUTTER;
// Use provided width or detect terminal width (respects COLUMNS env var)
- let term_width = max_width.unwrap_or_else(get_terminal_width);
+ let term_width = max_width.unwrap_or_else(terminal_width);
// Account for gutter (1) + space (1)
let available_width = term_width.saturating_sub(2);
@@ -255,7 +255,7 @@ fn format_bash_with_gutter_impl(content: &str, width_override: Option<usize>) ->
let string_style = bash_token_style("string").unwrap_or(dim);
// Calculate available width for content
- let term_width = width_override.unwrap_or_else(get_terminal_width);
+ let term_width = width_override.unwrap_or_else(terminal_width);
let available_width = term_width.saturating_sub(2);
// Set up tree-sitter bash highlighting
diff --git a/src/styling/mod.rs b/src/styling/mod.rs
index ca1908467..f1eedb435 100644
--- a/src/styling/mod.rs
+++ b/src/styling/mod.rs
@@ -75,7 +75,7 @@ pub fn verbosity() -> u8 {
/// When detection fails (piped context, no TTY), returns `usize::MAX` rather than
/// an arbitrary default. Callers that need width-based formatting will produce
/// full output, letting the consumer handle truncation.
-pub fn get_terminal_width() -> usize {
+pub fn terminal_width() -> usize {
// Prefer direct terminal detection (more accurate than COLUMNS which may be stale/wrong)
// Check stderr first (status messages), then stdout (table output)
if let Some((terminal_size::Width(w), _)) =
diff --git a/src/utils.rs b/src/utils.rs
index 2052cc709..f71ad7f22 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -20,9 +20,9 @@ pub fn format_timestamp_iso8601(timestamp: u64) -> String {
/// Format the current time as ISO 8601 string.
///
-/// Convenience function combining `get_now()` and `format_timestamp_iso8601()`.
+/// Convenience function combining `epoch_now()` and `format_timestamp_iso8601()`.
pub fn now_iso8601() -> String {
- format_timestamp_iso8601(get_now())
+ format_timestamp_iso8601(epoch_now())
}
/// Get current Unix timestamp in seconds.
@@ -38,7 +38,7 @@ pub fn now_iso8601() -> String {
///
/// All code that needs timestamps for display or storage should use this
/// function rather than `SystemTime::now()` directly.
-pub fn get_now() -> u64 {
+pub fn epoch_now() -> u64 {
std::env::var("WORKTRUNK_TEST_EPOCH")
.ok()
.and_then(|val| val.parse::<u64>().ok())
@@ -55,18 +55,18 @@ mod tests {
use super::*;
#[test]
- fn test_get_now_returns_reasonable_timestamp() {
- let now = get_now();
+ fn test_epoch_now_returns_reasonable_timestamp() {
+ let now = epoch_now();
// Should be after 2020-01-01
- assert!(now > 1577836800, "get_now() should return current time");
+ assert!(now > 1577836800, "epoch_now() should return current time");
}
#[test]
- fn test_get_now_respects_test_epoch() {
- // When WORKTRUNK_TEST_EPOCH is set (by test harness), get_now() returns it
+ fn test_epoch_now_respects_test_epoch() {
+ // When WORKTRUNK_TEST_EPOCH is set (by test harness), epoch_now() returns it
if let Ok(epoch) = std::env::var("WORKTRUNK_TEST_EPOCH") {
let expected: u64 = epoch.parse().unwrap();
- assert_eq!(get_now(), expected);
+ assert_eq!(epoch_now(), expected);
}
}
diff --git a/tests/CLAUDE.md b/tests/CLAUDE.md
index a8df5544e..262f631d1 100644
--- a/tests/CLAUDE.md
+++ b/tests/CLAUDE.md
@@ -386,4 +386,4 @@ repo.git_command(&[
]);
```
-**For production code** that needs timestamps, use `worktrunk::utils::get_now()` which respects `WORKTRUNK_TEST_EPOCH`. Using `SystemTime::now()` directly causes flaky tests.
+**For production code** that needs timestamps, use `worktrunk::utils::epoch_now()` which respects `WORKTRUNK_TEST_EPOCH`. Using `SystemTime::now()` directly causes flaky tests.
diff --git a/tests/common/shell.rs b/tests/common/shell.rs
index f8996b16a..9104a6aa1 100644
--- a/tests/common/shell.rs
+++ b/tests/common/shell.rs
@@ -1,7 +1,7 @@
use super::{TestRepo, wt_bin, wt_command};
/// Map shell display names to actual binaries.
-pub fn get_shell_binary(shell: &str) -> &str {
+pub fn shell_binary(shell: &str) -> &str {
match shell {
"nushell" => "nu",
"powershell" => "pwsh",
@@ -22,7 +22,7 @@ pub fn execute_shell_script(repo: &TestRepo, shell: &str, script: &str) -> Strin
let pair = super::open_pty();
- let mut cmd = CommandBuilder::new(get_shell_binary(shell));
+ let mut cmd = CommandBuilder::new(shell_binary(shell));
// Clear inherited environment for test isolation
cmd.env_clear();
@@ -47,7 +47,7 @@ pub fn execute_shell_script(repo: &TestRepo, shell: &str, script: &str) -> Strin
std::env::var("PATH").unwrap_or_else(|_| default_path.to_string()),
);
cmd.env("USER", "testuser");
- cmd.env("SHELL", get_shell_binary(shell));
+ cmd.env("SHELL", shell_binary(shell));
// Add repo's test environment (git config, worktrunk config, etc.)
for (key, value) in repo.test_env_vars() {
diff --git a/tests/integration_tests/ci_status.rs b/tests/integration_tests/ci_status.rs
index 236b748cb..040844f01 100644
--- a/tests/integration_tests/ci_status.rs
+++ b/tests/integration_tests/ci_status.rs
@@ -14,7 +14,7 @@ use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
/// Get the HEAD commit SHA for a branch
-fn get_branch_sha(repo: &TestRepo, branch: &str) -> String {
+fn branch_sha(repo: &TestRepo, branch: &str) -> String {
repo.git_output(&["rev-parse", branch])
}
@@ -62,7 +62,7 @@ fn setup_github_repo_with_feature(repo: &mut TestRepo) -> String {
]);
repo.add_worktree("feature");
setup_tracking_for_all_branches(repo, "origin");
- get_branch_sha(repo, "feature")
+ branch_sha(repo, "feature")
}
// =============================================================================
@@ -249,7 +249,7 @@ fn test_list_full_filters_by_repo_owner(mut repo: TestRepo) {
]);
repo.add_worktree("feature");
setup_tracking_for_all_branches(&repo, "origin");
- let head_sha = get_branch_sha(&repo, "feature");
+ let head_sha = branch_sha(&repo, "feature");
// Multiple PRs - only one from our org (should filter to my-org's PR)
let pr_json = format!(
@@ -307,7 +307,7 @@ platform = "github"
setup_tracking_for_all_branches(&repo, "github");
// Get actual commit SHA
- let head_sha = get_branch_sha(&repo, "feature");
+ let head_sha = branch_sha(&repo, "feature");
// Setup mock gh with PR data - this should work because platform is overridden to github
let pr_json = format!(
@@ -380,7 +380,7 @@ platform = "invalid_platform"
// Create a feature branch with tracking
repo.add_worktree("feature");
setup_tracking_for_all_branches(&repo, "origin");
- let head_sha = get_branch_sha(&repo, "feature");
+ let head_sha = branch_sha(&repo, "feature");
// Setup mock gh - platform should fall back to GitHub via URL detection
let pr_json = format!(
@@ -440,7 +440,7 @@ fn setup_gitlab_repo_with_feature(repo: &mut TestRepo) -> String {
]);
repo.add_worktree("feature");
setup_tracking_for_all_branches(repo, "origin");
- get_branch_sha(repo, "feature")
+ branch_sha(repo, "feature")
}
#[rstest]
@@ -529,7 +529,7 @@ fn test_list_full_with_gitlab_filters_by_project_id(mut repo: TestRepo) {
]);
repo.add_worktree("feature");
setup_tracking_for_all_branches(&repo, "origin");
- let head_sha = get_branch_sha(&repo, "feature");
+ let head_sha = branch_sha(&repo, "feature");
// Multiple MRs - only one from our project (should filter to project 99999)
// The "other" MR is listed first to prove filtering works (not just taking first element)
@@ -678,7 +678,7 @@ fn test_list_full_with_url_based_pushremote(mut repo: TestRepo) {
"https://github.com/upstream-owner/test-repo.git",
]);
repo.add_worktree("feature");
- let head_sha = get_branch_sha(&repo, "feature");
+ let head_sha = branch_sha(&repo, "feature");
// Simulate `gh pr checkout` behavior:
// - Sets pushremote to the fork URL (not a remote name)
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index d530ff1c8..ec4c05a5a 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -408,7 +408,7 @@ fn test_list_with_remotes_and_full(#[from(repo_with_remote)] repo: TestRepo) {
repo.run_git(&["branch", "-D", "feature-remote"]);
// Set a GitHub-style URL AFTER pushing so platform detection works
- // This exercises the remote_hint path in get_platform_for_repo
+ // This exercises the remote_hint path in platform_for_repo
repo.run_git(&[
"remote",
"set-url",
diff --git a/tests/integration_tests/readme_sync.rs b/tests/integration_tests/readme_sync.rs
index 8304656c3..150c8c162 100644
--- a/tests/integration_tests/readme_sync.rs
+++ b/tests/integration_tests/readme_sync.rs
@@ -563,7 +563,7 @@ fn convert_command_reference_to_html(content: &str) -> Result<String, String> {
/// Get help output for a command
///
/// Expected format: `wt <subcommand> --help-md` (ID includes backticks from marker)
-fn get_help_output(id: &str, project_root: &Path) -> Result<String, String> {
+fn help_output(id: &str, project_root: &Path) -> Result<String, String> {
// Strip backticks from ID (captured by MARKER_PATTERN)
let command = id.trim_matches('`');
let args: Vec<&str> = command.split_whitespace().collect();
@@ -826,7 +826,7 @@ fn transform_zola_to_github(content: &str) -> String {
///
/// Parses `path#anchor` ID format, extracts section(s) by anchor
/// (supports ranges like `start..end`), and transforms Zola links to GitHub URLs.
-fn get_docs_section_for_readme(id: &str, project_root: &Path) -> Result<String, String> {
+fn docs_section_for_readme(id: &str, project_root: &Path) -> Result<String, String> {
let (path, anchor) = id
.split_once('#')
.ok_or_else(|| format!("Invalid section ID (missing #): {}", id))?;
@@ -845,17 +845,15 @@ fn get_docs_section_for_readme(id: &str, project_root: &Path) -> Result<String,
/// Get content for a README marker based on its type
///
/// Handles help (`cmd`) and section (#anchor) markers.
-fn get_readme_content(
+fn generate_readme_content(
id: &str,
_current_content: &str,
project_root: &Path,
) -> Result<String, String> {
match MarkerType::from_id(id) {
MarkerType::Snapshot => unreachable!("README has no snapshot markers"),
- MarkerType::Help => get_help_output(id, project_root),
- MarkerType::Section => {
- get_docs_section_for_readme(id, project_root).map(|c| trim_lines(&c))
- }
+ MarkerType::Help => help_output(id, project_root),
+ MarkerType::Section => docs_section_for_readme(id, project_root).map(|c| trim_lines(&c)),
}
}
@@ -892,7 +890,7 @@ fn sync_readme_markers(
// Strip wrapper from current content (snapshots have ```console```, others are raw)
let current_inner = marker_type.extract_inner(&current_with_wrapper);
- let expected = match get_readme_content(&id, &current_with_wrapper, project_root) {
+ let expected = match generate_readme_content(&id, &current_with_wrapper, project_root) {
Ok(content) => content,
Err(e) => {
errors.push(format!("❌ {}: {}", id, e));
@@ -1304,7 +1302,7 @@ fn sync_help_markers(file_path: &Path, project_root: &Path) -> Result<usize, Vec
// Process in reverse order
for (start, end, id, current) in matches.into_iter().rev() {
- let expected = match get_help_output(&id, project_root) {
+ let expected = match help_output(&id, project_root) {
Ok(content) => content,
Err(e) => {
errors.push(format!("❌ {}: {}", id, e));
diff --git a/tests/integration_tests/repository.rs b/tests/integration_tests/repository.rs
index 2298d8aa9..d7545e4eb 100644
--- a/tests/integration_tests/repository.rs
+++ b/tests/integration_tests/repository.rs
@@ -300,7 +300,7 @@ fn test_project_identifier_no_remote_fallback() {
}
// =============================================================================
-// get_config/set_config tests
+// config_value/set_config tests
// =============================================================================
#[test]
@@ -312,7 +312,7 @@ fn test_get_config_exists() {
.unwrap();
let repository = Repository::at(repo.root_path().to_path_buf()).unwrap();
- let value = repository.get_config("test.key").unwrap();
+ let value = repository.config_value("test.key").unwrap();
assert_eq!(value, Some("test-value".to_string()));
}
@@ -321,7 +321,7 @@ fn test_get_config_not_exists() {
let repo = TestRepo::new();
let repository = Repository::at(repo.root_path().to_path_buf()).unwrap();
- let value = repository.get_config("nonexistent.key").unwrap();
+ let value = repository.config_value("nonexistent.key").unwrap();
assert!(value.is_none());
}
@@ -333,7 +333,7 @@ fn test_set_config() {
repository.set_config("test.setting", "new-value").unwrap();
// Verify it was set
- let value = repository.get_config("test.setting").unwrap();
+ let value = repository.config_value("test.setting").unwrap();
assert_eq!(value, Some("new-value".to_string()));
}
diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rs
index 42856c76c..9eaaf87bd 100644
--- a/tests/integration_tests/shell_wrapper.rs
+++ b/tests/integration_tests/shell_wrapper.rs
@@ -31,7 +31,7 @@
// =============================================================================
// Shared imports (both platforms)
-use crate::common::{TestRepo, shell::get_shell_binary, wt_bin};
+use crate::common::{TestRepo, shell::shell_binary, wt_bin};
use std::process::Command;
// Unix-only imports
@@ -374,7 +374,7 @@ fn exec_in_pty_interactive(
let pair = crate::common::open_pty();
- let shell_binary = get_shell_binary(shell);
+ let shell_binary = shell_binary(shell);
let mut cmd = CommandBuilder::new(shell_binary);
// Clear inherited environment for test isolation
@@ -3625,7 +3625,7 @@ mod windows_tests {
#[test]
fn test_conpty_powershell_basic() {
let pair = crate::common::open_pty();
- let shell_binary = get_shell_binary("powershell");
+ let shell_binary = shell_binary("powershell");
let mut cmd = portable_pty::CommandBuilder::new(shell_binary);
cmd.env_clear();
diff --git a/tests/integration_tests/step_diff.rs b/tests/integration_tests/step_diff.rs
index 4eecdd4dd..5c5bd9be5 100644
--- a/tests/integration_tests/step_diff.rs
+++ b/tests/integration_tests/step_diff.rs
@@ -110,7 +110,7 @@ fn test_step_diff_index_unchanged(mut repo: TestRepo) {
fs::write(feature_path.join("untracked.txt"), "content").unwrap();
// Get index state before
- let index_before = get_git_status(&repo, &feature_path);
+ let index_before = git_status(&repo, &feature_path);
// Run step diff
let mut cmd = repo.wt_command();
@@ -119,7 +119,7 @@ fn test_step_diff_index_unchanged(mut repo: TestRepo) {
assert!(output.status.success(), "step diff failed");
// Get index state after
- let index_after = get_git_status(&repo, &feature_path);
+ let index_after = git_status(&repo, &feature_path);
assert_eq!(
index_before, index_after,
@@ -142,7 +142,7 @@ fn test_step_diff_explicit_target(mut repo: TestRepo) {
));
}
-fn get_git_status(repo: &TestRepo, dir: &Path) -> String {
+fn git_status(repo: &TestRepo, dir: &Path) -> String {
let output = repo
.git_command()
.args(["status", "--porcelain"])
diff --git a/tests/integration_tests/step_promote.rs b/tests/integration_tests/step_promote.rs
index e38361fc6..558446ff2 100644
--- a/tests/integration_tests/step_promote.rs
+++ b/tests/integration_tests/step_promote.rs
@@ -7,7 +7,7 @@ use std::fs;
use std::process::Command;
/// Helper to get the current branch in a directory
-fn get_branch(repo: &TestRepo, dir: &std::path::Path) -> String {
+fn branch_name(repo: &TestRepo, dir: &std::path::Path) -> String {
let output = repo
.git_command()
.args(["rev-parse", "--abbrev-ref", "HEAD"])
@@ -38,12 +38,12 @@ fn test_promote_from_worktree(mut repo: TestRepo) {
// Verify branches were exchanged
assert_eq!(
- get_branch(&repo, repo.root_path()),
+ branch_name(&repo, repo.root_path()),
"feature",
"main worktree should now have feature"
);
assert_eq!(
- get_branch(&repo, &feature_path),
+ branch_name(&repo, &feature_path),
"main",
"other worktree should now have main"
);
@@ -65,12 +65,12 @@ fn test_promote_with_branch_argument(mut repo: TestRepo) {
// Verify branches were exchanged
assert_eq!(
- get_branch(&repo, repo.root_path()),
+ branch_name(&repo, repo.root_path()),
"feature",
"main worktree should now have feature"
);
assert_eq!(
- get_branch(&repo, &feature_path),
+ branch_name(&repo, &feature_path),
"main",
"other worktree should now have main"
);
@@ -95,7 +95,7 @@ fn test_promote_restore(mut repo: TestRepo) {
);
// Verify first promote worked
- assert_eq!(get_branch(&repo, repo.root_path()), "feature");
+ assert_eq!(branch_name(&repo, repo.root_path()), "feature");
// Restore: promote main back (now 'main' is in the other worktree)
assert_cmd_snapshot!(make_snapshot_cmd(
@@ -107,12 +107,12 @@ fn test_promote_restore(mut repo: TestRepo) {
// Verify canonical state restored
assert_eq!(
- get_branch(&repo, repo.root_path()),
+ branch_name(&repo, repo.root_path()),
"main",
"main worktree should have main again"
);
assert_eq!(
- get_branch(&repo, &feature_path),
+ branch_name(&repo, &feature_path),
"feature",
"other worktree should have feature again"
);
@@ -150,8 +150,8 @@ fn test_promote_auto_restore(mut repo: TestRepo) {
);
// Verify first promote worked
- assert_eq!(get_branch(&repo, repo.root_path()), "feature");
- assert_eq!(get_branch(&repo, &feature_path), "main");
+ assert_eq!(branch_name(&repo, repo.root_path()), "feature");
+ assert_eq!(branch_name(&repo, &feature_path), "main");
// Auto-restore: no argument from main worktree restores default branch
assert_cmd_snapshot!(make_snapshot_cmd(
@@ -163,12 +163,12 @@ fn test_promote_auto_restore(mut repo: TestRepo) {
// Verify canonical state restored
assert_eq!(
- get_branch(&repo, repo.root_path()),
+ branch_name(&repo, repo.root_path()),
"main",
"main worktree should have main again"
);
assert_eq!(
- get_branch(&repo, &feature_path),
+ branch_name(&repo, &feature_path),
"feature",
"other worktree should have feature again"
);
@@ -687,8 +687,8 @@ fn test_promote_swap_roundtrip(mut repo: TestRepo) {
);
// After round-trip: everything should be back to original state
- assert_eq!(get_branch(&repo, repo.root_path()), "main");
- assert_eq!(get_branch(&repo, &feature_path), "feature");
+ assert_eq!(branch_name(&repo, repo.root_path()), "main");
+ assert_eq!(branch_name(&repo, &feature_path), "feature");
assert_eq!(
fs::read_to_string(repo.root_path().join("build/artifact")).unwrap(),
diff --git a/tests/integration_tests/step_prune.rs b/tests/integration_tests/step_prune.rs
index 28e87f9fd..3bef4b1af 100644
--- a/tests/integration_tests/step_prune.rs
+++ b/tests/integration_tests/step_prune.rs
@@ -105,7 +105,7 @@ fn test_prune_skips_unmerged(mut repo: TestRepo) {
/// Min-age guard: worktrees younger than threshold are skipped.
///
-/// With test epoch (Jan 2025) and real file creation (Feb 2026), get_now()
+/// With test epoch (Jan 2025) and real file creation (Feb 2026), epoch_now()
/// returns a time before the file was created, so age is 0 — always younger
/// than any positive threshold. This verifies the guard works.
#[rstest]