@@ -83,7 +83,7 @@ static EXCLUDE_LUT: Lazy<Mutex<Option<git_worktree::fs::Cache<'static>>>> = Lazy
83
83
/// The major, minor and patch level of the git version on the system.
84
84
pub static GIT_VERSION: Lazy<(u8, u8, u8)> = Lazy::new(|| parse_git_version().expect("git version to be parsable"));
85
85
86
- /// Define how [scripted_fixture_repo_writable_with_args ()] uses produces the writable copy.
86
+ /// Define how [scripted_fixture_writable_with_args ()] uses produces the writable copy.
87
87
pub enum Creation {
88
88
/// Run the script once and copy the data from its output to the writable location.
89
89
/// This is fast but won't work if absolute paths are produced by the script.
@@ -205,7 +205,7 @@ pub fn fixture_bytes(path: impl AsRef<Path>) -> Vec<u8> {
205
205
}
206
206
}
207
207
208
- /// Run the executable at `script_name`, like `make_repo.sh` to produce a read-only directory to which
208
+ /// Run the script file `script_name` using `bash `, like `make_repo.sh` to produce a read-only directory to which
209
209
/// the path is returned.
210
210
///
211
211
/// Note that it persists and the script at `script_name` will only be executed once if it ran without error.
@@ -227,34 +227,34 @@ pub fn fixture_bytes(path: impl AsRef<Path>) -> Vec<u8> {
227
227
/// or more specific `.gitignore` configurations in lower levels of the work tree.
228
228
///
229
229
/// The latter is useful if the the script's output is platform specific.
230
- pub fn scripted_fixture_repo_read_only (script_name: impl AsRef<Path>) -> Result<PathBuf> {
231
- scripted_fixture_repo_read_only_with_args (script_name, None::<String>)
230
+ pub fn scripted_fixture_read_only (script_name: impl AsRef<Path>) -> Result<PathBuf> {
231
+ scripted_fixture_read_only_with_args (script_name, None::<String>)
232
232
}
233
233
234
234
/// Run the executable at `script_name`, like `make_repo.sh` to produce a writable directory to which
235
235
/// the tempdir is returned. It will be removed automatically, courtesy of [`tempfile::TempDir`].
236
236
///
237
237
/// Note that `script_name` is only executed once, so the data can be copied from its read-only location.
238
- pub fn scripted_fixture_repo_writable (script_name: &str) -> Result<tempfile::TempDir> {
239
- scripted_fixture_repo_writable_with_args (script_name, None::<String>, Creation::CopyFromReadOnly)
238
+ pub fn scripted_fixture_writable (script_name: &str) -> Result<tempfile::TempDir> {
239
+ scripted_fixture_writable_with_args (script_name, None::<String>, Creation::CopyFromReadOnly)
240
240
}
241
241
242
- /// Like [`scripted_fixture_repo_writable ()`], but passes `args` to `script_name` while providing control over
242
+ /// Like [`scripted_fixture_writable ()`], but passes `args` to `script_name` while providing control over
243
243
/// the way files are created with `mode`.
244
- pub fn scripted_fixture_repo_writable_with_args (
244
+ pub fn scripted_fixture_writable_with_args (
245
245
script_name: &str,
246
246
args: impl IntoIterator<Item = impl Into<String>>,
247
247
mode: Creation,
248
248
) -> Result<tempfile::TempDir> {
249
249
let dst = tempfile::TempDir::new()?;
250
250
Ok(match mode {
251
251
Creation::CopyFromReadOnly => {
252
- let ro_dir = scripted_fixture_repo_read_only_with_args_inner (script_name, args, None)?;
252
+ let ro_dir = scripted_fixture_read_only_with_args_inner (script_name, args, None)?;
253
253
copy_recursively_into_existing_dir(&ro_dir, dst.path())?;
254
254
dst
255
255
}
256
256
Creation::ExecuteScript => {
257
- scripted_fixture_repo_read_only_with_args_inner (script_name, args, dst.path().into())?;
257
+ scripted_fixture_read_only_with_args_inner (script_name, args, dst.path().into())?;
258
258
dst
259
259
}
260
260
})
@@ -279,15 +279,15 @@ pub fn copy_recursively_into_existing_dir(src_dir: impl AsRef<Path>, dst_dir: im
279
279
Ok(())
280
280
}
281
281
282
- /// Like `scripted_fixture_repo_read_only ()`], but passes `args` to `script_name`.
283
- pub fn scripted_fixture_repo_read_only_with_args (
282
+ /// Like `scripted_fixture_read_only ()`], but passes `args` to `script_name`.
283
+ pub fn scripted_fixture_read_only_with_args (
284
284
script_name: impl AsRef<Path>,
285
285
args: impl IntoIterator<Item = impl Into<String>>,
286
286
) -> Result<PathBuf> {
287
- scripted_fixture_repo_read_only_with_args_inner (script_name, args, None)
287
+ scripted_fixture_read_only_with_args_inner (script_name, args, None)
288
288
}
289
289
290
- fn scripted_fixture_repo_read_only_with_args_inner (
290
+ fn scripted_fixture_read_only_with_args_inner (
291
291
script_name: impl AsRef<Path>,
292
292
args: impl IntoIterator<Item = impl Into<String>>,
293
293
destination_dir: Option<&Path>,
@@ -397,7 +397,7 @@ fn scripted_fixture_repo_read_only_with_args_inner(
397
397
}
398
398
assert!(
399
399
output.status.success(),
400
- "repo script failed: stdout: {}\nstderr: {}",
400
+ "fixture script failed: stdout: {}\nstderr: {}",
401
401
output.stdout.as_bstr(),
402
402
output.stderr.as_bstr()
403
403
);
0 commit comments