Skip to content

Commit

Permalink
no longer need to update submodules on sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Oct 8, 2023
1 parent 1914fa6 commit 1099774
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geode"
version = "2.6.0"
version = "2.6.1"
authors = ["HJfod <[email protected]>", "Camila314 <[email protected]>", "matcool", "ConfiG <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand Down
37 changes: 2 additions & 35 deletions src/sdk.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clap::Subcommand;
use colored::Colorize;
use path_absolutize::Absolutize;
use crate::config::Config;
use crate::util::logging::ask_confirm;
use git2::build::{RepoBuilder, CheckoutBuilder};
Expand Down Expand Up @@ -108,37 +109,6 @@ fn uninstall() -> bool {
true
}

fn update_submodules_recurse(repo: &Repository) -> Result<(), git2::Error> {
for mut subm in repo.submodules()? {
let name = subm
.name()
.as_ref()
.map(|s| String::from(*s))
.unwrap_or_else(|| "<Unknown>".into());

let mut callbacks = RemoteCallbacks::new();
callbacks.sideband_progress(|x| {
print!(
"{} Cloning submodule {}: {}",
"| Info |".bright_cyan(),
name,
std::str::from_utf8(x).unwrap()
);
true
});

let mut opts = FetchOptions::new();
opts.remote_callbacks(callbacks);

let mut sopts = SubmoduleUpdateOptions::new();
sopts.fetch(opts);

subm.update(true, Some(&mut sopts))?;
update_submodules_recurse(&subm.open()?)?;
}
Ok(())
}

fn set_sdk_env(path: &Path) -> bool {
let env_success: bool;

Expand Down Expand Up @@ -204,6 +174,7 @@ fn get_sdk_path() -> Option<PathBuf> {
}

fn install(config: &mut Config, path: PathBuf, force: bool) {
let path = path.absolutize().nice_unwrap("Failed to get absolute path");
let parent = path.parent().unwrap();

if !force && std::env::var("GEODE_SDK").is_ok() {
Expand Down Expand Up @@ -248,10 +219,6 @@ fn install(config: &mut Config, path: PathBuf, force: bool) {
.clone("https://github.com/geode-sdk/geode", &path)
.nice_unwrap("Could not download SDK");

// update submodules, because for some reason
// Repository::update_submodules is private
update_submodules_recurse(&repo).nice_unwrap("Unable to update submodules!");

// set GEODE_SDK environment variable;
if set_sdk_env(&path) {
info!("Set GEODE_SDK environment variable automatically");
Expand Down

0 comments on commit 1099774

Please sign in to comment.