pub fn container_root(primary: &Path) -> Result<PathBuf>Expand description
The container of a repository whose primary checkout is primary: the checkout’s
sibling, named after it with CONTAINER_SUFFIX appended. Never read from anywhere,
never configured.
use majordomus_cli::worktree::container_root;
use std::path::{Path, PathBuf};
assert_eq!(container_root(Path::new("/a/foo")).unwrap(), PathBuf::from("/a/foo-wt"));
assert_eq!(container_root(Path::new("/src/acme/backend")).unwrap(), PathBuf::from("/src/acme/backend-wt"));
assert_eq!(container_root(Path::new("/a/some.repo")).unwrap(), PathBuf::from("/a/some.repo-wt"));
assert!(container_root(Path::new("/")).is_err());