Skip to content

Commit ccbd9f0

Browse files
committed
try to add -C flag to git
1 parent c345fad commit ccbd9f0

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

tmc-langs-cli/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,8 +1558,6 @@ fn run_settings(
15581558
let dir = matches.value_of("dir").unwrap();
15591559
let target = PathBuf::from(dir);
15601560

1561-
file_util::lock!(&target);
1562-
15631561
if target.is_file() {
15641562
anyhow::bail!("The target path points to a file.")
15651563
}

tmc-langs-util/src/task_executor/course_refresher.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,24 @@ fn update_or_clone_repository(
211211
.output_checked()
212212
};
213213

214-
run_git(&["remote", "set-url", "origin", course_source_url])?;
215-
run_git(&["fetch", "origin"])?;
216-
run_git(&["checkout", &format!("origin/{}", course_git_branch)])?;
217-
run_git(&["clean", "-df"])?;
218-
run_git(&["checkout", "."])?;
214+
let clone_path_str = new_clone_path.to_str().unwrap();
215+
run_git(&[
216+
"-C",
217+
clone_path_str,
218+
"remote",
219+
"set-url",
220+
"origin",
221+
course_source_url,
222+
])?;
223+
run_git(&["-C", clone_path_str, "fetch", "origin"])?;
224+
run_git(&[
225+
"-C",
226+
clone_path_str,
227+
"checkout",
228+
&format!("origin/{}", course_git_branch),
229+
])?;
230+
run_git(&["-C", clone_path_str, "clean", "-df"])?;
231+
run_git(&["-C", clone_path_str, "checkout", "."])?;
219232
Ok(())
220233
};
221234
match copy_and_update_repository() {

0 commit comments

Comments
 (0)