diff options
Diffstat (limited to 'src/utils/cwd.rs')
-rw-r--r-- | src/utils/cwd.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/utils/cwd.rs b/src/utils/cwd.rs deleted file mode 100644 index 78b47719..00000000 --- a/src/utils/cwd.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::path::PathBuf; - -/// Return current working directory of the user's shell process. I.e. the directory which they are -/// in when delta exits. This is the directory relative to which the file paths in delta output are -/// constructed if they are using either (a) delta's relative-paths option or (b) git's --relative -/// flag. -pub fn cwd_of_user_shell_process( - cwd_of_delta_process: Option<&PathBuf>, - cwd_relative_to_repo_root: Option<&str>, -) -> Option<PathBuf> { - match (cwd_of_delta_process, cwd_relative_to_repo_root) { - (Some(cwd), None) => { - // We are not a child process of git - Some(PathBuf::from(cwd)) - } - (Some(repo_root), Some(cwd_relative_to_repo_root)) => { - // We are a child process of git; git spawned us from repo_root and preserved the user's - // original cwd in the GIT_PREFIX env var (available as config.cwd_relative_to_repo_root) - Some(PathBuf::from(repo_root).join(cwd_relative_to_repo_root)) - } - (None, _) => { - // Unexpected - None - } - } -} |