From 2549b48a1e5684b13cd84c96ad5fa8d69cae0976 Mon Sep 17 00:00:00 2001 From: Michal Date: Fri, 22 Jul 2022 17:48:38 +0100 Subject: [PATCH] Added smart pull to parent git checker --- Cargo.lock | 2 +- src/main.rs | 8 ++++++-- src/operations/pull.rs | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0783c1b..de96b8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Malachite" -version = "1.4.0" +version = "2.0.0" dependencies = [ "clap", "colored", diff --git a/src/main.rs b/src/main.rs index 5117a23..358b96f 100755 --- a/src/main.rs +++ b/src/main.rs @@ -30,11 +30,13 @@ fn main() { if Path::exists("../.git".as_ref()) { info!("Parent directory is a git directory, pulling latest mlc.toml. It is advised you run mlc pull/update in all malachite directories"); + let config = read_cfg(verbose); + let dir = env::current_dir().unwrap(); env::set_current_dir("../").unwrap(); log!(verbose, "Current dir: {:?}", env::current_dir().unwrap()); - if read_cfg(args.verbose).smart_pull { + if config.smart_pull { log!(verbose, "Smart pull"); Command::new("git") .args(&["remote", "update"]) @@ -47,6 +49,7 @@ fn main() { .unwrap() .contains("Your branch is behind") { + info!("Branch out of date, pulling changes"); Command::new("git") .arg("pull") .spawn() @@ -64,8 +67,9 @@ fn main() { .unwrap() .wait() .unwrap(); - env::set_current_dir(dir).unwrap(); } + env::set_current_dir(dir).unwrap(); + log!(verbose, "Current dir: {:?}", env::current_dir().unwrap()); } match args.subcommand.unwrap_or(Operation::Clone) { diff --git a/src/operations/pull.rs b/src/operations/pull.rs index d704b94..c9d3bab 100644 --- a/src/operations/pull.rs +++ b/src/operations/pull.rs @@ -36,6 +36,7 @@ fn do_the_pulling(repos: Vec, verbose: bool, smart_pull: bool, build_on_ .to_string() .contains("Your branch is behind") { + info!("Branch out of date, pulling changes"); Command::new("git") .arg("pull") .spawn()