We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9040dc9 commit 66528ddCopy full SHA for 66528dd
git-branchless-lib/src/testing.rs
@@ -81,6 +81,9 @@ pub struct GitRunOptions {
81
82
/// Additional environment variables to start the process with.
83
pub env: HashMap<String, String>,
84
+
85
+ /// The working directory to start the process in.
86
+ pub working_dir: Option<PathBuf>,
87
}
88
89
impl Git {
@@ -217,6 +220,7 @@ impl Git {
217
220
expected_exit_code,
218
221
input,
219
222
env,
223
+ working_dir,
224
} = options;
225
226
let env: BTreeMap<_, _> = self
@@ -229,7 +233,7 @@ impl Git {
229
233
.collect();
230
234
let mut command = Command::new(&self.path_to_git);
231
235
command
232
- .current_dir(&self.repo_path)
236
+ .current_dir(working_dir.as_deref().unwrap_or(&self.repo_path))
237
.args(args)
238
.env_clear()
239
.envs(&env);
0 commit comments