upgrade git-repository to gix 0.36.1; up min. rustc version to 1.64

This fixes breakage when installing `helix` due to an incorrect usage of
`as_ref()` when interacting with `bstr` in the `gitoxide` codebase.

However, this upgrade also requires a higher rustc version, as `gitoxide`
recently updated its `windows` crate version.
This commit is contained in:
Sebastian Thiel 2023-02-20 16:48:13 +01:00 committed by Blaž Hrastnik
parent 725d9aecf0
commit ac9e0b39f2
4 changed files with 476 additions and 512 deletions

961
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -16,13 +16,13 @@ helix-core = { version = "0.6", path = "../helix-core" }
tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot", "macros"] } tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot", "macros"] }
parking_lot = "0.12" parking_lot = "0.12"
git-repository = { version = "0.32", default-features = false , optional = true } gix= { version = "0.36.1", default-features = false , optional = true }
imara-diff = "0.1.5" imara-diff = "0.1.5"
log = "0.4" log = "0.4"
[features] [features]
git = ["git-repository"] git = ["gix"]
[dev-dependencies] [dev-dependencies]
tempfile = "3.4" tempfile = "3.4"

View file

@ -1,9 +1,8 @@
use std::path::Path; use std::path::Path;
use git::objs::tree::EntryMode; use gix::objs::tree::EntryMode;
use git::sec::trust::DefaultForLevel; use gix::sec::trust::DefaultForLevel;
use git::{Commit, ObjectId, Repository, ThreadSafeRepository}; use gix::{Commit, ObjectId, Repository, ThreadSafeRepository};
use git_repository as git;
use crate::DiffProvider; use crate::DiffProvider;
@ -15,13 +14,13 @@ pub struct Git;
impl Git { impl Git {
fn open_repo(path: &Path, ceiling_dir: Option<&Path>) -> Option<ThreadSafeRepository> { fn open_repo(path: &Path, ceiling_dir: Option<&Path>) -> Option<ThreadSafeRepository> {
// custom open options // custom open options
let mut git_open_opts_map = git::sec::trust::Mapping::<git::open::Options>::default(); let mut git_open_opts_map = gix::sec::trust::Mapping::<gix::open::Options>::default();
// On windows various configuration options are bundled as part of the installations // On windows various configuration options are bundled as part of the installations
// This path depends on the install location of git and therefore requires some overhead to lookup // This path depends on the install location of git and therefore requires some overhead to lookup
// This is basically only used on windows and has some overhead hence it's disabled on other platforms. // This is basically only used on windows and has some overhead hence it's disabled on other platforms.
// `gitoxide` doesn't use this as default // `gitoxide` doesn't use this as default
let config = git::permissions::Config { let config = gix::permissions::Config {
system: true, system: true,
git: true, git: true,
user: true, user: true,
@ -30,16 +29,16 @@ impl Git {
git_binary: cfg!(windows), git_binary: cfg!(windows),
}; };
// change options for config permissions without touching anything else // change options for config permissions without touching anything else
git_open_opts_map.reduced = git_open_opts_map.reduced.permissions(git::Permissions { git_open_opts_map.reduced = git_open_opts_map.reduced.permissions(gix::Permissions {
config, config,
..git::Permissions::default_for_level(git::sec::Trust::Reduced) ..gix::Permissions::default_for_level(gix::sec::Trust::Reduced)
}); });
git_open_opts_map.full = git_open_opts_map.full.permissions(git::Permissions { git_open_opts_map.full = git_open_opts_map.full.permissions(gix::Permissions {
config, config,
..git::Permissions::default_for_level(git::sec::Trust::Full) ..gix::Permissions::default_for_level(gix::sec::Trust::Full)
}); });
let mut open_options = git::discover::upwards::Options::default(); let mut open_options = gix::discover::upwards::Options::default();
if let Some(ceiling_dir) = ceiling_dir { if let Some(ceiling_dir) = ceiling_dir {
open_options.ceiling_dirs = vec![ceiling_dir.to_owned()]; open_options.ceiling_dirs = vec![ceiling_dir.to_owned()];
} }

View file

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "1.63.0" channel = "1.64.0"
components = ["rustfmt", "rust-src"] components = ["rustfmt", "rust-src"]