git magic created too many issues

main
jan Michal 3 years ago
parent 9deac085e1
commit 58ff7a0090

@ -111,39 +111,11 @@ fn main() {
for r in config.repo { for r in config.repo {
info(format!("Cloning (repository mode): {}", r)); info(format!("Cloning (repository mode): {}", r));
Command::new("git") Command::new("git")
.args(&["clone", "--no-checkout", &r]) .args(&["clone", &r])
.spawn()
.unwrap()
.wait()
.unwrap();
info(format!("Entering working directory: {}", r));
let cdir = env::current_dir().unwrap();
let dir = format!(
"{}/{}",
env::current_dir().unwrap().display(),
r.split('/').collect::<Vec<&str>>().last().unwrap()
);
env::set_current_dir(dir).unwrap();
info(format!("Resetting unstaged files: {}", r));
Command::new("git")
.arg("reset")
.spawn()
.unwrap()
.wait()
.unwrap();
info(format!("Checking out PKGBUILD: {}", r));
Command::new("git")
.args(&["checkout", "HEAD", "PKGBUILD"])
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()
.unwrap(); .unwrap();
info(format!("Exiting work directory: {}", r));
env::set_current_dir(cdir).unwrap();
} }
} else { } else {
crash("Invalid mode in mlc.toml".to_string(), 1); crash("Invalid mode in mlc.toml".to_string(), 1);
@ -307,4 +279,4 @@ fn main() {
.wait() .wait()
.unwrap(); .unwrap();
} }
} }

Loading…
Cancel
Save