From 29b6b590a5a04ac8783b6246c701048a4f9f617f Mon Sep 17 00:00:00 2001 From: Michael Zhao <44533763+Pistonight@users.noreply.github.com> Date: Tue, 28 Nov 2023 21:58:33 -0800 Subject: [PATCH] fix error when .gitmodules doesn't exist (#6) --- Cargo.lock | 2 +- Cargo.toml | 6 +++--- src/status.rs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd2dc32..7956eaf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -157,7 +157,7 @@ checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "magoo" -version = "0.1.1" +version = "0.1.2" dependencies = [ "clap", "fs4", diff --git a/Cargo.toml b/Cargo.toml index 814b474..647f08e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "magoo" -version = "0.1.1" +version = "0.1.2" edition = "2021" description = "A wrapper for git submodule that simplifies the workflows" repository = "https://github.com/Pistonite/magoo" license = "MIT" authors = ["Pistonight "] -keywords = ["git", "tool", "submodule"] -categories = ["development-tools"] +keywords = ["git", "tool", "submodule", "cli"] +categories = ["development-tools", "command-line-utilities"] exclude = [ ".github/**/*", "README.txtpp.md", diff --git a/src/status.rs b/src/status.rs index 82e60e0..e6cbdcb 100644 --- a/src/status.rs +++ b/src/status.rs @@ -101,7 +101,8 @@ impl Status { let dot_gitmodules_path = top_level_dir.join(".gitmodules"); let config_entries = - Self::read_submodule_from_config(context, &dot_gitmodules_path.to_cmd_arg())?; + Self::read_submodule_from_config(context, &dot_gitmodules_path.to_cmd_arg()) + .unwrap_or_default(); for (key, value) in config_entries { let name = if let Some(name) = key.strip_suffix(".path") {