Skip to content

Commit f52ae55

Browse files
authored
fix(git): upgrade gitoxide to v0.21 (starship#4277)
* upgrade `gitoxide` to v0.21 This release comes with lenient configuration handling by default, allowing to open repositories even their configuration values are invalid (even for git), as long as there are viable defaults. Furthermore this release adds the ability to open submodule repsitories. Fixes starship#4266 and fixes starship#4272 * Assure an object cache is set to speed up `commit.describe()` Related to starship#4275 bringing performance to spitting distance compared to git.
1 parent 12d72de commit f52ae55

File tree

3 files changed

+69
-44
lines changed

3 files changed

+69
-44
lines changed

Cargo.lock

+65-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dunce = "1.0.2"
4444
gethostname = "0.2.3"
4545
# Addresses https://github.com/starship/starship/issues/4251
4646
git-features = { version = "0.22.1", features = ["fs-walkdir-single-threaded"] }
47-
git-repository = "0.20.0"
47+
git-repository = "0.21.0"
4848
indexmap = { version = "1.9.1", features = ["serde"] }
4949
local_ipaddress = "0.1.3"
5050
log = { version = "0.4.16", features = ["std"] }

src/modules/git_commit.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
5151
}
5252

5353
fn git_tag(repo: &Repo) -> Option<String> {
54-
let git_repo = repo.open();
54+
// allow environment variables like GITOXIDE_OBJECT_CACHE_MEMORY and GITOXIDE_DISABLE_PACK_CACHE to speed up operation for some repos
55+
let mut git_repo = repo.open().apply_environment();
56+
git_repo.object_cache_size_if_unset(4 * 1024 * 1024);
5557
let head_commit = git_repo.head_commit().ok()?;
5658

5759
let describe_platform = head_commit.describe().names(AnnotatedTags);

0 commit comments

Comments
 (0)