aboutsummaryrefslogtreecommitdiff
path: root/src/workspace/git/status.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-28 15:34:13 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-28 15:34:13 +0300
commite16d7d8c07a20f5ee0b4111808680bbcfd7df9ac (patch)
tree2c5c338c6096deaad1487b4b77e71d671e30b842 /src/workspace/git/status.rs
parent81f355fadac7d0d45b077dfc28f9f679add6bbb6 (diff)
fix: preserve linked worktree workspace labels
Diffstat (limited to 'src/workspace/git/status.rs')
-rw-r--r--src/workspace/git/status.rs25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/workspace/git/status.rs b/src/workspace/git/status.rs
index fe873e29..dcfc1aff 100644
--- a/src/workspace/git/status.rs
+++ b/src/workspace/git/status.rs
@@ -6,9 +6,9 @@ use crate::workspace::{GitSpaceMetadata, WorkspaceGitStatusSnapshot};
use super::{
config::{read_branch_config, upstream_full_ref},
discovery::{
- canonicalize_best_effort_path, fallback_label_from_cwd, git_ref_storage_is_reftable,
- git_rev_parse_verify, git_space_metadata_from_info, git_symbolic_head_full,
- git_worktree_info, read_ref_oid, GitWorktreeInfo,
+ automatic_workspace_label, canonicalize_best_effort_path, fallback_label_from_cwd,
+ git_ref_storage_is_reftable, git_rev_parse_verify, git_space_metadata_from_info,
+ git_symbolic_head_full, git_worktree_info, read_ref_oid, GitWorktreeInfo,
},
};
@@ -111,8 +111,8 @@ pub fn git_status_snapshot_for_cwd_with_demand(
}),
);
};
+ let auto_label = automatic_workspace_label(cwd, &info.repo_root);
let space = git_space_metadata_from_info(&info);
- let auto_label = space.label.clone();
if !demand.ahead_behind {
let branch = demand
@@ -530,6 +530,23 @@ mod tests {
}
#[test]
+ fn linked_worktree_refresh_keeps_checkout_name_as_auto_label() {
+ let (base, _, checkout) =
+ crate::workspace::git::test_support::create_repo_with_linked_worktree(
+ "linked-refresh-label",
+ );
+
+ let (snapshot, _) = git_status_snapshot_for_cwd(&checkout, None);
+
+ assert_eq!(
+ snapshot.auto_label,
+ checkout.file_name().unwrap().to_str().unwrap()
+ );
+
+ std::fs::remove_dir_all(base).unwrap();
+ }
+
+ #[test]
fn git_status_cache_key_is_per_linked_worktree_checkout() {
let base = temp_test_dir("linked-worktree-keys");
let common_dir = base.join("repo/.git");