Skip to content

Commit fc2640c

Browse files
committed
feat: read BASH_DISABLE_GIT_FILE_TRACKING env var...
... to allow user disable git file tracking (git status). In some repositories with a lot of files (e.g. aosc-os-abbs), disabling this feature will improve PS1 performance
1 parent 400865d commit fc2640c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.vcs_git

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ _ps1_git_status() {
4545
8)
4646
echo -e "\01\e[1m\02@\01\e[0;37m\0002$bgs\01\e[0m\02"
4747
;;
48+
9)
49+
echo -e "\01\e[1m\02@\01\e[0;32m\0002$bgs\01\e[0m\02"
50+
;;
4851
esac
4952
}
5053

src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use gix::{
66
Repository, ThreadSafeRepository,
77
};
88
use log::debug;
9+
use std::env;
910
use std::path::Path;
1011
use std::process::Command;
1112
use std::{path::PathBuf, process::exit};
@@ -51,6 +52,12 @@ fn main() {
5152
}
5253

5354
fn print_and_get_status(progress_status: &str) -> i32 {
55+
println!("{progress_status}");
56+
57+
if env::var("BASH_DISABLE_GIT_FILE_TRACKING").is_ok() {
58+
return 9;
59+
}
60+
5461
let cmd = Command::new("git")
5562
.arg("status")
5663
.arg("--porcelain")
@@ -90,8 +97,6 @@ fn print_and_get_status(progress_status: &str) -> i32 {
9097
}
9198
}
9299

93-
println!("{progress_status}");
94-
95100
status
96101
}
97102

0 commit comments

Comments
 (0)