/// Updates all git submodules that we have.
///
/// This will detect if any submodules are out of date an run the necessary
/// commands to sync them all with upstream.
Updates all git submodules that we have.
This will detect if any submodules are out of date an run the necessary
commands to sync them all with upstream.
Updates all git submodules that we have . This will detect if any submodules are out of date an run the necessary commands to sync them all with upstream .
fn update_submodules(&self) {
        if !self.config.submodules {
            return
        }
        if fs::metadata(self.src.join(".git")).is_err() {
            return
        }
        let git_submodule = || {
            let mut cmd = Command::new("git");
            cmd.current_dir(&self.src).arg("submodule");
            return cmd
        };
        // FIXME: this takes a seriously long time to execute on Windows and a
        //        nontrivial amount of time on Unix, we should have a better way
        //        of detecting whether we need to run all the submodule commands
        //        below.
        let out = output(git_submodule().arg("status"));
        if !out.lines().any(|l| l.starts_with("+") || l.starts_with("-")) {
            return
        }
        self.run(git_submodule().arg("sync"));
        self.run(git_submodule().arg("init"));
        self.run(git_submodule().arg("update"));
        self.run(git_submodule().arg("update").arg("--recursive"));
        self.run(git_submodule().arg("status").arg("--recursive"));
        self.run(git_submodule().arg("foreach").arg("--recursive")
                                .arg("git").arg("clean").arg("-fdx"));
        self.run(git_submodule().arg("foreach").arg("--recursive")
                                .arg("git").arg("checkout").arg("."));
    }
fn update_submodules ( & self ) { if ! self . config . submodules { return } if fs :: metadata ( self . src . join ( " " ) ) . is_err ( ) { return } let git_submodule = | | { let mut cmd = Command :: new ( " " ) ; cmd . current_dir ( & self . src ) . arg ( " " ) ; return cmd } ; // FIXME: this takes a seriously long time to execute on Windows and a //        nontrivial amount of time on Unix, we should have a better way //        of detecting whether we need to run all the submodule commands //        below. let out = output ( git_submodule ( ) . arg ( " " ) ) ; if ! out . lines ( ) . any ( | l | l . starts_with ( " " ) || l . starts_with ( " " ) ) { return } self . run ( git_submodule ( ) . arg ( " " ) ) ; self . run ( git_submodule ( ) . arg ( " " ) ) ; self . run ( git_submodule ( ) . arg ( " " ) ) ; self . run ( git_submodule ( ) . arg ( " " ) . arg ( " " ) ) ; self . run ( git_submodule ( ) . arg ( " " ) . arg ( " " ) ) ; self . run ( git_submodule ( ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) ) ; self . run ( git_submodule ( ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) ) ; }
Updates all git submodules that we have.
Updates all git submodules that we have .
&self