mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
chore: drop unrelated worktree exclude test from #2867 branch
Keeps PR #2938 scoped to bare cross-linked repo status only (#2876 is covered separately).
This commit is contained in:
parent
679d9a154d
commit
2d32230041
1 changed files with 0 additions and 85 deletions
|
|
@ -377,91 +377,6 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
/// Regression for https://github.com/gitui-org/gitui/issues/2876
|
||||
#[test]
|
||||
fn test_info_exclude_honored_in_linked_worktree() {
|
||||
use std::process::Command;
|
||||
|
||||
let (_td, repo) = repo_init().unwrap();
|
||||
let main_root = repo.workdir().unwrap().to_path_buf();
|
||||
let main_repo_path: RepoPath =
|
||||
main_root.as_os_str().to_str().unwrap().into();
|
||||
|
||||
let exclude = main_root.join(".git/info/exclude");
|
||||
std::fs::write(&exclude, ".cache/\n").unwrap();
|
||||
|
||||
let linked_td = TempDir::new().unwrap();
|
||||
let linked_root = linked_td.path().to_path_buf();
|
||||
let status = Command::new("git")
|
||||
.args([
|
||||
"worktree",
|
||||
"add",
|
||||
"-b",
|
||||
"wt",
|
||||
linked_root.to_str().unwrap(),
|
||||
"HEAD",
|
||||
])
|
||||
.current_dir(&main_root)
|
||||
.status()
|
||||
.unwrap();
|
||||
assert!(status.success());
|
||||
|
||||
let cache_dir = linked_root.join(".cache");
|
||||
std::fs::create_dir_all(&cache_dir).unwrap();
|
||||
std::fs::write(cache_dir.join("foo"), "clangd").unwrap();
|
||||
|
||||
let main_status = get_status(
|
||||
&main_repo_path,
|
||||
StatusType::WorkingDir,
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(
|
||||
main_status.is_empty(),
|
||||
"main worktree should honor info/exclude: {main_status:?}"
|
||||
);
|
||||
|
||||
let linked_repo_path: RepoPath =
|
||||
linked_root.as_os_str().to_str().unwrap().into();
|
||||
let linked_status = get_status(
|
||||
&linked_repo_path,
|
||||
StatusType::WorkingDir,
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(
|
||||
linked_status.is_empty(),
|
||||
"linked worktree should honor info/exclude: {linked_status:?}"
|
||||
);
|
||||
|
||||
assert!(
|
||||
is_workdir_clean(&linked_repo_path, None).unwrap(),
|
||||
"libgit2 status should honor info/exclude in linked worktree"
|
||||
);
|
||||
|
||||
// Simulate explicit GIT_DIR + GIT_WORK_TREE (bare-style open).
|
||||
let gitdir = std::fs::read_to_string(linked_root.join(".git"))
|
||||
.unwrap()
|
||||
.trim()
|
||||
.strip_prefix("gitdir: ")
|
||||
.unwrap()
|
||||
.to_string();
|
||||
let explicit_path = RepoPath::Workdir {
|
||||
gitdir: gitdir.into(),
|
||||
workdir: linked_root.clone(),
|
||||
};
|
||||
let explicit_status = get_status(
|
||||
&explicit_path,
|
||||
StatusType::WorkingDir,
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(
|
||||
explicit_status.is_empty(),
|
||||
"explicit worktree gitdir should honor info/exclude: {explicit_status:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_crosslinked_bare_repo_no_workdir_status() {
|
||||
use crate::sync::tests::debug_cmd_print;
|
||||
|
|
|
|||
Loading…
Reference in a new issue