diff options
author | yuri <1969yuri1969@gmail.com> | 2019-09-29 05:50:38 +0200 |
---|---|---|
committer | Kevin Song <chipbuster@users.noreply.github.com> | 2019-09-28 22:50:38 -0500 |
commit | 63a45d01f949596f6ee0b037c84b6e0cee598b7d (patch) | |
tree | faf264fb5f1cedb33e1dc4a3656aec4aee17c38a /src/modules | |
parent | 8c56729d26ada71f86de2120227db4d1dfd327c3 (diff) |
feat: Use tilde for home_directory when under version control (#439)
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/directory.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/modules/directory.rs b/src/modules/directory.rs index 01cd6c011..4bab47c71 100644 --- a/src/modules/directory.rs +++ b/src/modules/directory.rs @@ -8,7 +8,8 @@ use super::{Context, Module}; /// /// Will perform path contraction and truncation. /// **Contraction** -/// - Paths beginning with the home directory will be contracted to `~` +/// - Paths beginning with the home directory or with a git repo right +/// inside the home directory will be contracted to `~` /// - Paths containing a git repo will contract to begin at the repo root /// /// **Truncation** @@ -57,7 +58,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { let repo = &context.get_repo().ok()?; let dir_string = match &repo.root { - Some(repo_root) if truncate_to_repo => { + Some(repo_root) if truncate_to_repo && (repo_root != &home_dir) => { let repo_folder_name = repo_root.file_name().unwrap().to_str().unwrap(); // Contract the path to the git repo root |