Deps: update miette and git-config (#406)

This commit is contained in:
Félix Saparelli 2022-09-07 14:52:53 +12:00 committed by GitHub
parent 669ad6a7bf
commit 24a3a3c2f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 277 additions and 43 deletions

272
Cargo.lock generated
View File

@ -280,7 +280,18 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
dependencies = [
"lazy_static",
"memchr",
"regex-automata",
]
[[package]]
name = "btoi"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97c0869a9faa81f8bbf8102371105d6d0a7b79167a04c340b04ab16892246a11"
dependencies = [
"num-traits",
]
[[package]]
@ -444,6 +455,19 @@ dependencies = [
"once_cell",
]
[[package]]
name = "dashmap"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [
"cfg-if 1.0.0",
"hashbrown",
"lock_api",
"once_cell",
"parking_lot_core",
]
[[package]]
name = "derivative"
version = "2.2.0"
@ -737,29 +761,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
[[package]]
name = "git-config"
version = "0.2.1"
name = "git-actor"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a552e3de993c389623e23b71a888c8356acfcb6e4232ce8420fba4710a44921b"
checksum = "5f71e800c934ad4cb177a1a396a6ea57e4cb493bd5278d350752205570863478"
dependencies = [
"bstr",
"dirs 4.0.0",
"btoi",
"git-date",
"itoa",
"nom 7.1.1",
"quick-error",
]
[[package]]
name = "git-config"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d533a785dd345fb133acde7a88ac264de96a1982cecad7f0e8a644ff4c39dcc5"
dependencies = [
"bitflags",
"bstr",
"git-features",
"git-glob",
"git-path",
"git-ref",
"git-sec",
"libc",
"memchr",
"nom 7.1.1",
"pwd",
"quick-error",
"smallvec",
"thiserror",
"unicode-bom",
]
[[package]]
name = "git-features"
version = "0.20.0"
name = "git-date"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ebc06d6b83be53d9c7a00937a6baed4566aad7dba12af11ac830ea72c080af0"
checksum = "1d58ccaaf783384a6ad68a6abf84942a3f88e34970ced3b34dc68183be50996d"
dependencies = [
"bstr",
"itoa",
"time",
]
[[package]]
name = "git-features"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50af1af32068e5fb709ee479afc414ae98216869dfb1238ca99894a9073be34a"
dependencies = [
"git-hash",
"libc",
"sha1_smol",
"walkdir",
]
[[package]]
name = "git-glob"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1879e27b5cb57bee828ea57a1ce9a004e9ae51fa71a2d4fb031175386df246"
dependencies = [
"bitflags",
"bstr",
]
[[package]]
@ -772,6 +838,102 @@ dependencies = [
"thiserror",
]
[[package]]
name = "git-lock"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ff6ad736a93573e219cb9b81c2edb6df0ced812f886e8003df375d96e650e73"
dependencies = [
"fastrand",
"git-tempfile",
"quick-error",
]
[[package]]
name = "git-object"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd987a3518738c902bd654f9b6ae7aa24934bf5a80b1614f8afb3a02c9bb16d3"
dependencies = [
"bstr",
"btoi",
"git-actor",
"git-features",
"git-hash",
"git-validate",
"hex",
"itoa",
"nom 7.1.1",
"quick-error",
"smallvec",
]
[[package]]
name = "git-path"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05c3657d6f51d4d29b47812a77c0bb4df705d4d5bcd4fa41fd45729265e3420"
dependencies = [
"bstr",
"thiserror",
]
[[package]]
name = "git-ref"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0c5926938f4732a200a5897f512234bf6d23e4bc5f23a6d371aae4a66c51020"
dependencies = [
"git-actor",
"git-features",
"git-hash",
"git-lock",
"git-object",
"git-path",
"git-tempfile",
"git-validate",
"memmap2",
"nom 7.1.1",
"quick-error",
]
[[package]]
name = "git-sec"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0073a138d171b64d5251726620c2232f695f7fbcfa7e5678dc62c1c19846f0e5"
dependencies = [
"bitflags",
"dirs 4.0.0",
"git-path",
"libc",
"windows 0.37.0",
]
[[package]]
name = "git-tempfile"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baed392d47397d32d29be06bc09824a259a44df85614fd301ef98e69770a15b9"
dependencies = [
"dashmap",
"libc",
"once_cell",
"signal-hook",
"signal-hook-registry",
"tempfile",
]
[[package]]
name = "git-validate"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7af1453adfe6011f0ef71824591b7cdd85850c27bbf3dc8fa855574bed2fe107"
dependencies = [
"bstr",
"quick-error",
]
[[package]]
name = "globset"
version = "0.4.9"
@ -1125,6 +1287,15 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memmap2"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498"
dependencies = [
"libc",
]
[[package]]
name = "memoffset"
version = "0.6.5"
@ -1136,9 +1307,9 @@ dependencies = [
[[package]]
name = "miette"
version = "4.7.1"
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c"
checksum = "a28d6092d7e94a90bb9ea8e6c26c99d5d112d49dda2afdb4f7ea8cf09e1a5a6d"
dependencies = [
"atty",
"backtrace",
@ -1156,9 +1327,9 @@ dependencies = [
[[package]]
name = "miette-derive"
version = "4.7.1"
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c"
checksum = "4f2485ed7d1fe80704928e3eb86387439609bd0c6bb96db8208daa364cfd1e09"
dependencies = [
"proc-macro2",
"quote",
@ -1580,16 +1751,6 @@ dependencies = [
"prost",
]
[[package]]
name = "pwd"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72c71c0c79b9701efe4e1e4b563b2016dd4ee789eb99badcb09d61ac4b92e4a2"
dependencies = [
"libc",
"thiserror",
]
[[package]]
name = "quick-error"
version = "2.0.1"
@ -1849,6 +2010,16 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "signal-hook"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.0"
@ -2066,10 +2237,18 @@ version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
dependencies = [
"itoa",
"libc",
"num_threads",
"time-macros",
]
[[package]]
name = "time-macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
[[package]]
name = "tokio"
version = "1.21.0"
@ -2603,13 +2782,26 @@ dependencies = [
"windows_x86_64_msvc 0.24.0",
]
[[package]]
name = "windows"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647"
dependencies = [
"windows_aarch64_msvc 0.37.0",
"windows_i686_gnu 0.37.0",
"windows_i686_msvc 0.37.0",
"windows_x86_64_gnu 0.37.0",
"windows_x86_64_msvc 0.37.0",
]
[[package]]
name = "windows-sys"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc",
"windows_aarch64_msvc 0.36.1",
"windows_i686_gnu 0.36.1",
"windows_i686_msvc 0.36.1",
"windows_x86_64_gnu 0.36.1",
@ -2622,6 +2814,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_aarch64_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a"
[[package]]
name = "windows_i686_gnu"
version = "0.24.0"
@ -2634,6 +2832,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_gnu"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1"
[[package]]
name = "windows_i686_msvc"
version = "0.24.0"
@ -2646,6 +2850,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_i686_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c"
[[package]]
name = "windows_x86_64_gnu"
version = "0.24.0"
@ -2658,6 +2868,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.24.0"
@ -2670,6 +2886,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "windows_x86_64_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d"
[[package]]
name = "winreg"
version = "0.10.1"
@ -2686,7 +2908,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007a0353840b23e0c6dc73e5b962ff58ed7f6bc9ceff3ce7fe6fbad8d496edf4"
dependencies = [
"strum",
"windows",
"windows 0.24.0",
"xml-rs",
]

View File

@ -24,7 +24,7 @@ console-subscriber = { version = "0.1.0", optional = true }
dirs = "4.0.0"
dunce = "1.0.2"
futures = "0.3.17"
miette = { version = "4.7.1", features = ["fancy"] }
miette = { version = "5.3.0", features = ["fancy"] }
notify-rust = "4.5.2"
tracing = "0.1.26"

View File

@ -16,7 +16,7 @@ rust-version = "1.60.0"
edition = "2021"
[dependencies]
miette = "4.7.1"
miette = "5.3.0"
thiserror = "1.0.26"
tracing = "0.1.26"
dunce = "1.0.2"

View File

@ -17,11 +17,11 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
ignore = "0.4.18"
git-config = "0.2.0"
git-config = "0.7.1"
tokio = { version = "1.19.2", default-features = false, features = ["fs"] }
tracing = "0.1.35"
dunce = "1.0.2"
miette = "4.7.1"
miette = "5.3.0"
thiserror = "1.0.31"
[dependencies.project-origins]

View File

@ -5,10 +5,7 @@ use std::{
path::{Path, PathBuf},
};
use git_config::{
file::{from_paths, GitConfig},
values::Path as GitPath,
};
use git_config::{path::interpolate::Context as InterpolateContext, File, Path as GitPath};
use project_origins::ProjectType;
use tokio::fs::{metadata, read_dir};
use tracing::{trace, trace_span};
@ -56,11 +53,18 @@ pub async fn from_origin(path: impl AsRef<Path>) -> (Vec<IgnoreFile>, Vec<Error>
match find_file(base.join(".git/config")).await {
Err(err) => errors.push(err),
Ok(None) => {}
Ok(Some(path)) => match GitConfig::open(&path) {
Err(err) => errors.push(Error::new(ErrorKind::Other, err)),
Ok(config) => {
Ok(Some(path)) => match path.parent().map(File::from_git_dir) {
None => errors.push(Error::new(
ErrorKind::Other,
"unreachable: .git/config must have a parent",
)),
Some(Err(err)) => errors.push(Error::new(ErrorKind::Other, err)),
Some(Ok(config)) => {
if let Ok(excludes) = config.value::<GitPath<'_>>("core", None, "excludesFile") {
match excludes.interpolate(None) {
match excludes.interpolate(InterpolateContext {
home_dir: env::var("HOME").ok().map(PathBuf::from).as_deref(),
..Default::default()
}) {
Ok(e) => {
discover_file(
&mut files,
@ -200,12 +204,20 @@ pub async fn from_environment(appname: Option<&str>) -> (Vec<IgnoreFile>, Vec<Er
}
let mut found_git_global = false;
let options = from_paths::Options::default();
match GitConfig::from_env_paths(&options) {
match File::from_environment_overrides().map(|mut env| {
File::from_globals().map(move |glo| {
env.append(glo);
env
})
}) {
Err(err) => errors.push(Error::new(ErrorKind::Other, err)),
Ok(config) => {
Ok(Err(err)) => errors.push(Error::new(ErrorKind::Other, err)),
Ok(Ok(config)) => {
if let Ok(excludes) = config.value::<GitPath<'_>>("core", None, "excludesFile") {
match excludes.interpolate(None) {
match excludes.interpolate(InterpolateContext {
home_dir: env::var("HOME").ok().map(PathBuf::from).as_deref(),
..Default::default()
}) {
Ok(e) => {
if discover_file(
&mut files,

View File

@ -22,7 +22,7 @@ atomic-take = "1.0.0"
clearscreen = "1.0.9"
dunce = "1.0.2"
futures = "0.3.16"
miette = "4.7.1"
miette = "5.3.0"
once_cell = "1.8.0"
thiserror = "1.0.26"

View File

@ -21,5 +21,5 @@ tokio-stream = { version = "0.1.9", features = ["fs"] }
[dev-dependencies]
dunce = "1.0.2"
miette = "4.7.1"
miette = "5.3.0"
tracing-subscriber = "0.3.11"