diff options
Diffstat (limited to 'vendor/gix-path')
-rw-r--r-- | vendor/gix-path/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-path/CHANGELOG.md | 164 | ||||
-rw-r--r-- | vendor/gix-path/Cargo.toml | 11 | ||||
-rw-r--r-- | vendor/gix-path/src/convert.rs | 5 | ||||
-rw-r--r-- | vendor/gix-path/src/env/git.rs | 3 | ||||
-rw-r--r-- | vendor/gix-path/src/lib.rs | 7 | ||||
-rw-r--r-- | vendor/gix-path/src/realpath.rs | 7 | ||||
-rw-r--r-- | vendor/gix-path/src/spec.rs | 53 |
8 files changed, 178 insertions, 74 deletions
diff --git a/vendor/gix-path/.cargo-checksum.json b/vendor/gix-path/.cargo-checksum.json index 3ef08e37e..099e91084 100644 --- a/vendor/gix-path/.cargo-checksum.json +++ b/vendor/gix-path/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"d013e4d30eb0d6832534aeac978922fd4fa04bfc39bf88f2c0b93f153015257c","Cargo.toml":"4aa21fd6ef47f0a1243717df78746d5deb67f7736b37da3adc0c2af8e17b8cf8","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/convert.rs":"74fe4e59e977a2a60baa9d931695fb4b3c8d846a096f8bb74bed1c19e285e243","src/env/git.rs":"8f5bb3d8e45942ab259aaf1ae1dbd132574b41e11f235d074e2a229fff536960","src/env/mod.rs":"543c835f411cff72bc979c764e634b64f3367273223f94878c0c159618445502","src/lib.rs":"0d5a05b8d6181343962083a9207ebe3532e1698d5131e3f91bc7ea7c25ff3428","src/realpath.rs":"052ae9574a7a3fc9ad97c001a2df0599d3df4c7473a7034ecf4f7f16ee42ea70","src/spec.rs":"e21701ba9cf733027711f57d13c2cad9a47954b459c9d7c900d2e3fd5aad18f6","src/util.rs":"68be77fd1f0d7deed34643b2b7564a9a1dd783e4b90bf59e79c0560b9cb73ea3"},"package":"c1226f2e50adeb4d76c754c1856c06f13a24cad1624801653fbf09b869e5b808"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"622d0e769d4cfe3425c5d4af6c2ad343a74af1e4ced4f45c38225e9bf42c9103","Cargo.toml":"b316e137e4f05891b866496da2c4f40ef766c4c0022c9c4404d9eb4dd438189f","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/convert.rs":"4f788f81dbca4b10c7e5acd5e3216cc25766f96b35275b57125f2f85eb7d0782","src/env/git.rs":"5ae9e129bbeb51bba33732bfc8d49e68fd00b09a1ab006b280549a9a0eda31f6","src/env/mod.rs":"543c835f411cff72bc979c764e634b64f3367273223f94878c0c159618445502","src/lib.rs":"18dd0b96d339f1c0f5e947a80543094ff6edcb05177e2a3b0d0b21b2357ea7ad","src/realpath.rs":"f2ab476c14cdd11c3949fee1b405a5273f3118fdfcc94882f39886e5d6f48b41","src/util.rs":"68be77fd1f0d7deed34643b2b7564a9a1dd783e4b90bf59e79c0560b9cb73ea3"},"package":"6a1d370115171e3ae03c5c6d4f7d096f2981a40ddccb98dfd704c773530ba73b"}
\ No newline at end of file diff --git a/vendor/gix-path/CHANGELOG.md b/vendor/gix-path/CHANGELOG.md index 13ae9fad3..75d3ef491 100644 --- a/vendor/gix-path/CHANGELOG.md +++ b/vendor/gix-path/CHANGELOG.md @@ -5,6 +5,167 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.10.0 (2023-09-08) + +### Bug Fixes (BREAKING) + + - <csr-id-072ee32f693a31161cd6a843da6582d13efbb20b/> use `dyn` trait where possible. + This reduces compile time due to avoiding duplication. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 commits contributed to the release over the course of 17 calendar days. + - 17 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Prepare changelogs for release ([`375db06`](https://github.com/Byron/gitoxide/commit/375db06a8442378c3f7a922fae38e2a6694d9d04)) + - Merge branch `dyn`ification ([`f658fcc`](https://github.com/Byron/gitoxide/commit/f658fcc52dc2200ae34ca53dc10be97fb9012057)) + - Use `dyn` trait where possible. ([`072ee32`](https://github.com/Byron/gitoxide/commit/072ee32f693a31161cd6a843da6582d13efbb20b)) + - Merge branch 'gix-submodule' ([`363ee77`](https://github.com/Byron/gitoxide/commit/363ee77400805f473c9ad66eadad9214e7ab66f4)) +</details> + +## 0.9.0 (2023-08-22) + +<csr-id-229bd4899213f749a7cc124aa2b82a1368fba40f/> +<csr-id-5b5983a9686e9fe61a29e9e1b9e905cd4dbd296a/> + +### Chore + + - <csr-id-229bd4899213f749a7cc124aa2b82a1368fba40f/> don't call crate 'WIP' in manifest anymore. + +### Other + + - <csr-id-5b5983a9686e9fe61a29e9e1b9e905cd4dbd296a/> make clear that `normalize()` does not touch duplicate path separators nor single `.`. + +### New Features (BREAKING) + + - <csr-id-df83d746ff44ae192b7c69356624ff8b4cc61dcd/> remove `Spec` type in favor of `gix-pathspec::Pattern`. + The latter isn't included to keep concerns and crates separate. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 6 commits contributed to the release over the course of 12 calendar days. + - 30 days passed between releases. + - 3 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-date v0.7.3, gix-hash v0.12.0, gix-features v0.33.0, gix-actor v0.25.0, gix-object v0.35.0, gix-path v0.9.0, gix-glob v0.11.0, gix-quote v0.4.7, gix-attributes v0.17.0, gix-command v0.2.9, gix-packetline-blocking v0.16.5, gix-filter v0.3.0, gix-fs v0.5.0, gix-commitgraph v0.19.0, gix-hashtable v0.3.0, gix-revwalk v0.6.0, gix-traverse v0.31.0, gix-worktree-stream v0.3.0, gix-archive v0.3.0, gix-config-value v0.13.0, gix-tempfile v8.0.0, gix-lock v8.0.0, gix-ref v0.35.0, gix-sec v0.9.0, gix-config v0.28.0, gix-prompt v0.6.0, gix-url v0.22.0, gix-credentials v0.18.0, gix-diff v0.34.0, gix-discover v0.23.0, gix-ignore v0.6.0, gix-bitmap v0.2.7, gix-index v0.22.0, gix-mailmap v0.17.0, gix-negotiate v0.6.0, gix-pack v0.41.0, gix-odb v0.51.0, gix-pathspec v0.1.0, gix-packetline v0.16.5, gix-transport v0.35.0, gix-protocol v0.38.0, gix-revision v0.20.0, gix-refspec v0.16.0, gix-submodule v0.2.0, gix-worktree v0.24.0, gix-worktree-state v0.1.0, gix v0.52.0, gitoxide-core v0.31.0, gitoxide v0.29.0, safety bump 41 crates ([`30b2761`](https://github.com/Byron/gitoxide/commit/30b27615047692d3ced1b2d9c2ac15a80f79fbee)) + - Update changelogs prior to release ([`f23ea88`](https://github.com/Byron/gitoxide/commit/f23ea8828f2d9ba7559973daca388c9591bcc5fc)) + - Don't call crate 'WIP' in manifest anymore. ([`229bd48`](https://github.com/Byron/gitoxide/commit/229bd4899213f749a7cc124aa2b82a1368fba40f)) + - Merge branch 'pathspec-matching' ([`9f4dfe0`](https://github.com/Byron/gitoxide/commit/9f4dfe0f0b948280692916b596923959ea2fd9da)) + - Remove `Spec` type in favor of `gix-pathspec::Pattern`. ([`df83d74`](https://github.com/Byron/gitoxide/commit/df83d746ff44ae192b7c69356624ff8b4cc61dcd)) + - Make clear that `normalize()` does not touch duplicate path separators nor single `.`. ([`5b5983a`](https://github.com/Byron/gitoxide/commit/5b5983a9686e9fe61a29e9e1b9e905cd4dbd296a)) +</details> + +## 0.8.4 (2023-07-22) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 commits contributed to the release over the course of 1 calendar day. + - 23 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-features v0.32.1, gix-actor v0.24.1, gix-validate v0.7.7, gix-object v0.33.1, gix-path v0.8.4, gix-glob v0.10.1, gix-quote v0.4.6, gix-attributes v0.16.0, gix-command v0.2.8, gix-packetline-blocking v0.16.4, gix-filter v0.2.0, gix-fs v0.4.1, gix-chunk v0.4.4, gix-commitgraph v0.18.1, gix-hashtable v0.2.4, gix-revwalk v0.4.1, gix-traverse v0.30.1, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.5, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.1, gix-sec v0.8.4, gix-prompt v0.5.4, gix-url v0.21.1, gix-credentials v0.17.1, gix-diff v0.33.1, gix-discover v0.22.1, gix-ignore v0.5.1, gix-bitmap v0.2.6, gix-index v0.21.1, gix-mailmap v0.16.1, gix-negotiate v0.5.1, gix-pack v0.40.1, gix-odb v0.50.1, gix-packetline v0.16.4, gix-transport v0.34.1, gix-protocol v0.36.1, gix-revision v0.18.1, gix-refspec v0.14.1, gix-worktree v0.23.0, gix v0.50.0, safety bump 5 crates ([`16295b5`](https://github.com/Byron/gitoxide/commit/16295b58e2581d2e8b8b762816f52baabe871c75)) + - Release gix-date v0.7.1, gix-hash v0.11.4, gix-trace v0.1.3, gix-features v0.32.0, gix-actor v0.24.0, gix-validate v0.7.7, gix-object v0.33.0, gix-path v0.8.4, gix-glob v0.10.0, gix-quote v0.4.6, gix-attributes v0.15.0, gix-command v0.2.7, gix-packetline-blocking v0.16.3, gix-filter v0.1.0, gix-fs v0.4.0, gix-chunk v0.4.4, gix-commitgraph v0.18.0, gix-hashtable v0.2.4, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.4, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.0, gix-sec v0.8.4, gix-prompt v0.5.3, gix-url v0.21.0, gix-credentials v0.17.0, gix-diff v0.33.0, gix-discover v0.22.0, gix-ignore v0.5.0, gix-bitmap v0.2.6, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-packetline v0.16.4, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.1 ([`5cb3589`](https://github.com/Byron/gitoxide/commit/5cb3589b74fc5376e02cbfe151e71344e1c417fe)) + - Update changelogs prior to release ([`2fc66b5`](https://github.com/Byron/gitoxide/commit/2fc66b55097ed494b72d1af939ba5561f71fde97)) + - Update license field following SPDX 2.1 license expression standard ([`9064ea3`](https://github.com/Byron/gitoxide/commit/9064ea31fae4dc59a56bdd3a06c0ddc990ee689e)) +</details> + +## 0.8.3 (2023-06-29) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release. + - 6 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-features v0.31.1, gix-path v0.8.3, gix v0.48.0 ([`9ca3464`](https://github.com/Byron/gitoxide/commit/9ca346462806671fbc49643a87cea25ab0da3be8)) + - Prepare changelogs once more ([`4bf355a`](https://github.com/Byron/gitoxide/commit/4bf355a8c6a7dbcdb49105af3208d56a0ed8628d)) + - Adjust `gix-trace` to the latest version. ([`353df4b`](https://github.com/Byron/gitoxide/commit/353df4bf59c7aa98da48bcdcc299f947d9449f55)) +</details> + +## 0.8.2 (2023-06-22) + +<csr-id-bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d/> + +### Chore + + - <csr-id-bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d/> Add `clippy::redundant-closure-for-method-calls` lint + +### New Features + + - <csr-id-3cffa268460eb2d41bd6a30d45778b88db4ec602/> provide basic `tracing` spans for common operations. + This is just the beginning and more crates will integrate with it over time. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 8 commits contributed to the release over the course of 10 calendar days. + - 15 days passed between releases. + - 2 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-date v0.6.0, gix-hash v0.11.3, gix-trace v0.1.1, gix-features v0.31.0, gix-actor v0.22.0, gix-path v0.8.2, gix-glob v0.9.0, gix-quote v0.4.5, gix-attributes v0.14.0, gix-chunk v0.4.3, gix-commitgraph v0.17.0, gix-config-value v0.12.2, gix-fs v0.3.0, gix-tempfile v7.0.0, gix-utils v0.1.3, gix-lock v7.0.0, gix-validate v0.7.6, gix-object v0.31.0, gix-ref v0.31.0, gix-sec v0.8.2, gix-config v0.24.0, gix-command v0.2.6, gix-prompt v0.5.2, gix-url v0.20.0, gix-credentials v0.16.0, gix-diff v0.31.0, gix-discover v0.20.0, gix-hashtable v0.2.2, gix-ignore v0.4.0, gix-bitmap v0.2.5, gix-revwalk v0.2.0, gix-traverse v0.28.0, gix-index v0.19.0, gix-mailmap v0.14.0, gix-negotiate v0.3.0, gix-pack v0.38.0, gix-odb v0.48.0, gix-packetline v0.16.3, gix-transport v0.33.0, gix-protocol v0.34.0, gix-revision v0.16.0, gix-refspec v0.12.0, gix-worktree v0.20.0, gix v0.47.0, gitoxide-core v0.29.0, gitoxide v0.27.0, safety bump 30 crates ([`ea9f942`](https://github.com/Byron/gitoxide/commit/ea9f9424e777f10da0e33bb9ffbbefd01c4c5a74)) + - Prepare changelogs prior to release ([`18b0a37`](https://github.com/Byron/gitoxide/commit/18b0a371941aa2d4d62512437d5daa351ba99ffd)) + - Merge branch 'corpus' ([`aa16c8c`](https://github.com/Byron/gitoxide/commit/aa16c8ce91452a3e3063cf1cf0240b6014c4743f)) + - Release gix-trace v0.1.0 ([`2ab69c6`](https://github.com/Byron/gitoxide/commit/2ab69c6fd142fcbbf6df3f981b1550b0c8167a04)) + - Change MSRV to 1.65 ([`4f635fc`](https://github.com/Byron/gitoxide/commit/4f635fc4429350bae2582d25de86429969d28f30)) + - Provide basic `tracing` spans for common operations. ([`3cffa26`](https://github.com/Byron/gitoxide/commit/3cffa268460eb2d41bd6a30d45778b88db4ec602)) + - Merge branch 'help-874-redundant-closures' ([`fe59956`](https://github.com/Byron/gitoxide/commit/fe59956ad667303a923d7cfd9ffd72283df41d78)) + - Add `clippy::redundant-closure-for-method-calls` lint ([`bcad5c2`](https://github.com/Byron/gitoxide/commit/bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d)) +</details> + ## 0.8.1 (2023-06-06) A maintenance release without user-facing changes. @@ -13,7 +174,7 @@ A maintenance release without user-facing changes. <csr-read-only-do-not-edit/> - - 6 commits contributed to the release over the course of 12 calendar days. + - 7 commits contributed to the release over the course of 12 calendar days. - 40 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -25,6 +186,7 @@ A maintenance release without user-facing changes. <details><summary>view details</summary> * **Uncategorized** + - Release gix-date v0.5.1, gix-hash v0.11.2, gix-features v0.30.0, gix-actor v0.21.0, gix-path v0.8.1, gix-glob v0.8.0, gix-quote v0.4.4, gix-attributes v0.13.0, gix-chunk v0.4.2, gix-commitgraph v0.16.0, gix-config-value v0.12.1, gix-fs v0.2.0, gix-tempfile v6.0.0, gix-utils v0.1.2, gix-lock v6.0.0, gix-validate v0.7.5, gix-object v0.30.0, gix-ref v0.30.0, gix-sec v0.8.1, gix-config v0.23.0, gix-command v0.2.5, gix-prompt v0.5.1, gix-url v0.19.0, gix-credentials v0.15.0, gix-diff v0.30.0, gix-discover v0.19.0, gix-hashtable v0.2.1, gix-ignore v0.3.0, gix-bitmap v0.2.4, gix-traverse v0.26.0, gix-index v0.17.0, gix-mailmap v0.13.0, gix-revision v0.15.0, gix-negotiate v0.2.0, gix-pack v0.36.0, gix-odb v0.46.0, gix-packetline v0.16.2, gix-transport v0.32.0, gix-protocol v0.33.0, gix-refspec v0.11.0, gix-worktree v0.18.0, gix v0.45.0, safety bump 29 crates ([`9a9fa96`](https://github.com/Byron/gitoxide/commit/9a9fa96fa8a722bddc5c3b2270b0edf8f6615141)) - Prepare changelogs prior to release ([`8f15cec`](https://github.com/Byron/gitoxide/commit/8f15cec1ec7d5a9d56bb158f155011ef2bb3539b)) - Merge branch 'auto-clippy' ([`dbf8aa1`](https://github.com/Byron/gitoxide/commit/dbf8aa19d19109195d0274928eae4b94f248cd88)) - Merge branch 'main' into auto-clippy ([`3ef5c90`](https://github.com/Byron/gitoxide/commit/3ef5c90aebce23385815f1df674c1d28d58b4b0d)) diff --git a/vendor/gix-path/Cargo.toml b/vendor/gix-path/Cargo.toml index 107952a63..12b8db477 100644 --- a/vendor/gix-path/Cargo.toml +++ b/vendor/gix-path/Cargo.toml @@ -11,17 +11,17 @@ [package] edition = "2021" -rust-version = "1.64" +rust-version = "1.65" name = "gix-path" -version = "0.8.1" +version = "0.10.0" authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] include = [ "src/**/*", "LICENSE-*", "CHANGELOG.md", ] -description = "A WIP crate of the gitoxide project dealing paths and their conversions" -license = "MIT/Apache-2.0" +description = "A crate of the gitoxide project dealing paths and their conversions" +license = "MIT OR Apache-2.0" repository = "https://github.com/Byron/gitoxide" [lib] @@ -32,6 +32,9 @@ version = "1.3.0" features = ["std"] default-features = false +[dependencies.gix-trace] +version = "^0.1.3" + [dependencies.once_cell] version = "1.17.1" diff --git a/vendor/gix-path/src/convert.rs b/vendor/gix-path/src/convert.rs index d8bf70353..445255757 100644 --- a/vendor/gix-path/src/convert.rs +++ b/vendor/gix-path/src/convert.rs @@ -239,6 +239,7 @@ pub fn to_windows_separators<'a>(path: impl Into<Cow<'a, BStr>>) -> Cow<'a, BStr /// Resolve relative components virtually without accessing the file system, e.g. turn `a/./b/c/.././..` into `a`, /// without keeping intermediate `..` and `/a/../b/..` becomes `/`. /// If the input path was relative and ends up being the `current_dir`, `.` is returned instead of the full path to `current_dir`. +/// Note that single `.` components as well as duplicate separators are left untouched. /// /// This is particularly useful when manipulating paths that are based on user input, and not resolving intermediate /// symlinks keeps the path similar to what the user provided. If that's not desirable, use `[realpath()][crate::realpath()` @@ -248,14 +249,12 @@ pub fn to_windows_separators<'a>(path: impl Into<Cow<'a, BStr>>) -> Cow<'a, BStr /// as typical return value of `std::env::current_dir()`. /// As a `current_dir` like `/c` can be exhausted by paths like `../../r`, `None` will be returned to indicate the inability /// to produce a logically consistent path. -pub fn normalize<'a>(path: impl Into<Cow<'a, Path>>, current_dir: impl AsRef<Path>) -> Option<Cow<'a, Path>> { +pub fn normalize<'a>(path: Cow<'a, Path>, current_dir: &Path) -> Option<Cow<'a, Path>> { use std::path::Component::ParentDir; - let path = path.into(); if !path.components().any(|c| matches!(c, ParentDir)) { return Some(path); } - let current_dir = current_dir.as_ref(); let mut current_dir_opt = Some(current_dir); let was_relative = path.is_relative(); let components = path.components(); diff --git a/vendor/gix-path/src/env/git.rs b/vendor/gix-path/src/env/git.rs index 2e5d867bb..b8a9bc0d5 100644 --- a/vendor/gix-path/src/env/git.rs +++ b/vendor/gix-path/src/env/git.rs @@ -8,6 +8,7 @@ use bstr::{BStr, BString, ByteSlice}; /// Returns the file that contains git configuration coming with the installation of the `git` file in the current `PATH`, or `None` /// if no `git` executable was found or there were other errors during execution. pub(crate) fn install_config_path() -> Option<&'static BStr> { + let _span = gix_trace::detail!("gix_path::git::install_config_path()"); static PATH: once_cell::sync::Lazy<Option<BString>> = once_cell::sync::Lazy::new(|| { // Shortcut: in Msys shells this variable is set which allows to deduce the installation directory // so we can save the `git` invocation. @@ -23,7 +24,7 @@ pub(crate) fn install_config_path() -> Option<&'static BStr> { .stderr(Stdio::null()); first_file_from_config_with_origin(cmd.output().ok()?.stdout.as_slice().into()).map(ToOwned::to_owned) }); - PATH.as_ref().map(|b| b.as_ref()) + PATH.as_ref().map(AsRef::as_ref) } fn first_file_from_config_with_origin(source: &BStr) -> Option<&BStr> { diff --git a/vendor/gix-path/src/lib.rs b/vendor/gix-path/src/lib.rs index 6895aca46..888141d3c 100644 --- a/vendor/gix-path/src/lib.rs +++ b/vendor/gix-path/src/lib.rs @@ -50,19 +50,12 @@ #![forbid(unsafe_code)] /// A dummy type to represent path specs and help finding all spots that take path specs once it is implemented. - -/// A preliminary version of a path-spec based on glances of the code. -#[derive(Clone, Debug)] -pub struct Spec(bstr::BString); - mod convert; pub use convert::*; mod util; pub use util::is_absolute; -mod spec; - /// pub mod realpath; pub use realpath::function::{realpath, realpath_opts}; diff --git a/vendor/gix-path/src/realpath.rs b/vendor/gix-path/src/realpath.rs index 8b88eb15e..2969bd4d7 100644 --- a/vendor/gix-path/src/realpath.rs +++ b/vendor/gix-path/src/realpath.rs @@ -31,19 +31,18 @@ pub(crate) mod function { /// /// If `path` is relative, the current working directory be used to make it absolute. pub fn realpath(path: impl AsRef<Path>) -> Result<PathBuf, Error> { + let path = path.as_ref(); let cwd = path - .as_ref() .is_relative() .then(std::env::current_dir) .unwrap_or_else(|| Ok(PathBuf::default())) .map_err(Error::CurrentWorkingDir)?; - realpath_opts(path, cwd, MAX_SYMLINKS) + realpath_opts(path, &cwd, MAX_SYMLINKS) } /// The same as [`realpath()`], but allow to configure `max_symlinks` to configure how many symbolic links we are going to follow. /// This serves to avoid running into cycles or doing unreasonable amounts of work. - pub fn realpath_opts(path: impl AsRef<Path>, cwd: impl AsRef<Path>, max_symlinks: u8) -> Result<PathBuf, Error> { - let path = path.as_ref(); + pub fn realpath_opts(path: &Path, cwd: &Path, max_symlinks: u8) -> Result<PathBuf, Error> { if path.as_os_str().is_empty() { return Err(Error::EmptyPath); } diff --git a/vendor/gix-path/src/spec.rs b/vendor/gix-path/src/spec.rs deleted file mode 100644 index 0ff9e661c..000000000 --- a/vendor/gix-path/src/spec.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::ffi::OsStr; - -use bstr::{BStr, ByteSlice, ByteVec}; - -use crate::Spec; - -impl std::convert::TryFrom<&OsStr> for Spec { - type Error = crate::Utf8Error; - - fn try_from(value: &OsStr) -> Result<Self, Self::Error> { - crate::os_str_into_bstr(value).map(|value| { - assert_valid_hack(value); - Spec(value.into()) - }) - } -} - -fn assert_valid_hack(input: &BStr) { - assert!(!input.contains_str(b"/../")); - assert!(!input.contains_str(b"/./")); - assert!(!input.starts_with_str(b"../")); - assert!(!input.starts_with_str(b"./")); - assert!(!input.starts_with_str(b"/")); -} - -impl Spec { - /// Parse `input` into a `Spec` or `None` if it could not be parsed - // TODO: tests, actual implementation probably via `gix-pathspec` to make use of the crate after all. - pub fn from_bytes(input: &BStr) -> Option<Self> { - assert_valid_hack(input); - Spec(input.into()).into() - } - /// Return all paths described by this path spec, using slashes on all platforms. - pub fn items(&self) -> impl Iterator<Item = &BStr> { - std::iter::once(self.0.as_bstr()) - } - /// Adjust this path specification according to the given `prefix`, which may be empty to indicate we are the at work-tree root. - // TODO: this is a hack, needs test and time to do according to spec. This is just a minimum version to have -something-. - pub fn apply_prefix(&mut self, prefix: &std::path::Path) -> &Self { - // many more things we can't handle. `Path` never ends with trailing path separator. - let prefix = crate::into_bstr(prefix); - if !prefix.is_empty() { - let mut prefix = crate::to_unix_separators_on_windows(prefix); - { - let path = prefix.to_mut(); - path.push_byte(b'/'); - path.extend_from_slice(&self.0); - } - self.0 = prefix.into_owned(); - } - self - } -} |