aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-02-24 02:47:06 -0500
committerJesse Luehrs <doy@tozt.net>2018-02-24 02:47:06 -0500
commit6276c8206d85cc4939df72d71a4c15e685e21f2b (patch)
treea25f8100fd225204c5fa6c8b0372064944a0d506
parentc1743ad8c51ed02f04b2526180285df6c0795a6e (diff)
downloadfancy-prompt-6276c8206d85cc4939df72d71a4c15e685e21f2b.tar.gz
fancy-prompt-6276c8206d85cc4939df72d71a4c15e685e21f2b.zip
display uninitialized repositories a bit better
-rw-r--r--src/prompt.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/prompt.rs b/src/prompt.rs
index 940029f..374d143 100644
--- a/src/prompt.rs
+++ b/src/prompt.rs
@@ -283,6 +283,7 @@ fn format_vcs(vcs_info: &Option<Box<vcs::VcsInfo>>) -> Option<String> {
}
if !vcs_info.has_commits() {
write!(vcs, "!").unwrap();
+ return vcs;
}
let branch = vcs_info.branch().map(|branch| {
@@ -656,5 +657,22 @@ mod test {
Some(String::from("g*+?:dev:-"))
)
}
+ {
+ let test_vcs = TestVcs {
+ vcs: vcs::VcsType::Git,
+ has_modified_files: false,
+ has_staged_files: false,
+ has_new_files: false,
+ has_commits: false,
+ active_operation: vcs::ActiveOperation::None,
+ branch: None,
+ remote_branch_diff: None,
+ };
+
+ assert_eq!(
+ format_vcs(&Some(Box::new(test_vcs))),
+ Some(String::from("g!"))
+ )
+ }
}
}