History

fix!: Remove `git-config` test utilities from `git-path`.

Sebastian Thiel committed 4 years ago

Commit c9933c01 parent aaf1cde4 files · +48 −53Browse files

Showing the changes to git-path/src (1 of 4 files). Show all

Unified · Split

git-path/src/lib.rs+3−49
@@ -1,4 +1,4 @@
1−#![forbid(unsafe_code, rust_2018_idioms)]
1+#![forbid(unsafe_code, rust_2018_idioms, missing_docs)]
22 //! This crate contains an assortment of utilities to deal with paths and their conversions.
33 //!
44 //! Generally `git` treats paths as bytes, but inherently assumes non-illformed UTF-8 as encoding on windows. Internally, it expects
@@ -55,56 +55,10 @@ · 50 unmodified lines
5555 pub struct Spec(bstr::BString);
5656
5757 mod convert;
58−mod spec;
59−
60−use std::{fs::create_dir_all, ops::Deref, path::Path};
61−
6258 pub use convert::*;
63−use tempfile::tempdir_in;
59+
60+mod spec;
6461
6562 ///
6663 pub mod realpath;
6764 pub use realpath::function::{realpath, realpath_opts};
68−
69−pub fn create_symlink(from: &Path, to: &Path) {
70− create_dir_all(from.parent().unwrap()).unwrap();
71− #[cfg(not(target_os = "windows"))]
72− std::os::unix::fs::symlink(to, &from).unwrap();
73− #[cfg(target_os = "windows")]
74− std::os::windows::fs::symlink_file(to, &from).unwrap();
75−}
76−
77−pub struct CanonicalizedTempDir {
78− pub dir: tempfile::TempDir,
79−}
80−
81−impl CanonicalizedTempDir {
82− pub fn new() -> Self {
83− #[cfg(windows)]
84− let canonicalized_tempdir = std::env::temp_dir();
85− #[cfg(not(windows))]
86− let canonicalized_tempdir = std::env::temp_dir().canonicalize().unwrap();
87− let dir = tempdir_in(canonicalized_tempdir).unwrap();
88− Self { dir }
89− }
90−}
91−
92−impl Default for CanonicalizedTempDir {
93− fn default() -> Self {
94− Self::new()
95− }
96−}
97−
98−impl AsRef<Path> for CanonicalizedTempDir {
99− fn as_ref(&self) -> &Path {
100− self
101− }
102−}
103−
104−impl Deref for CanonicalizedTempDir {
105− type Target = Path;
106−
107− fn deref(&self) -> &Self::Target {
108− self.dir.path()
109− }
110−}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t