summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2022-11-07 14:06:33 +0100
committerqkzk <qu3nt1n@gmail.com>2022-11-07 14:06:33 +0100
commit6e0fcde08d109997f02f83d85f98d018b00c5f07 (patch)
tree31f73d83bb257f3ce658b4f1653b40c32a6ce5e3
parent5d18139b22f20f37eb4a3dc7f7c3fd87e00882de (diff)
readme. Propagate write errors to callergit
-rw-r--r--readme.md1
-rw-r--r--src/display.rs2
-rw-r--r--src/git.rs4
3 files changed, 4 insertions, 3 deletions
diff --git a/readme.md b/readme.md
index 2505c114..9fb9c6da 100644
--- a/readme.md
+++ b/readme.md
@@ -97,6 +97,7 @@
- [x] drag & drop: exec and find dragon-drop
- [x] optional numbers in preview
- [x] logging with rotating log files.
+- [x] git integration in first line of normal mode.
## TODO
diff --git a/src/display.rs b/src/display.rs
index 3cf13194..9e09afea 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -90,7 +90,7 @@ impl Display {
let tab = status.selected_non_mut();
let first_row: String = match tab.mode {
Mode::Normal => {
- let git_string = git(tab.path_content.path.clone())?;
+ let git_string = git(&tab.path_content.path)?;
format!(
"Tab: {}/{} -- Path: {} -- Files: {} -- {}",
status.index + 1,
diff --git a/src/git.rs b/src/git.rs
index 8dbbe743..8e121d84 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -4,7 +4,7 @@
use std::error::Error;
use std::fmt::Write as _;
-use std::path::PathBuf;
+use std::path::Path;
use std::process;
struct GitStatus {
@@ -73,7 +73,7 @@ fn parse_porcelain2(data: String) -> Option<GitStatus> {
Some(status)
}
-pub fn git(path: PathBuf) -> Result<String, Box<dyn Error>> {
+pub fn git(path: &Path) -> Result<String, Box<dyn Error>> {
if std::env::set_current_dir(&path).is_err() {
// The path may not exist. It should never happen.
return Ok("".to_owned());