Skip to main content

default_root

Function default_root 

Source
pub fn default_root() -> PathBuf
Expand description

The workspace NetGet owns when allowed_root is not given.

Deliberately neither $HOME nor the process’s working directory: the second would be whatever repository the operator happened to launch NetGet from, which is precisely the thing being protected. The platform’s local-data directory gives NetGet a subtree nothing else writes to, stable across runs, so a repository cloned by one client is still there for the next one — ~/Library/Application Support/netget/git-workspace on macOS, ~/.local/share/netget/git-workspace on Linux, %LOCALAPPDATA%\netget\git-workspace on Windows.

Not ~/.netget/git-workspace, which was the obvious first choice and is impossible: Settings::settings_path (src/settings.rs) makes ~/.netget NetGet’s settings file, so create_dir_all on a path beneath it fails with ENOTDIR. It was the existing Git client tests that caught this, which is a good argument for having them.