Skip to content

Commit

Permalink
Fix error when git add fails because .gitmodules doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Pistonight committed Dec 3, 2023
1 parent 66e76cb commit d7468e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 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 = "magoo"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
description = "A wrapper for git submodule that simplifies the workflows"
repository = "https://github.com/Pistonite/magoo"
Expand Down
6 changes: 4 additions & 2 deletions src/submodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ impl Submodule {
top_level_dir.join(".gitmodules"),
&format!("submodule.{name}"),
);
context.add(".gitmodules")?;
// add may fail if .gitmodules doesn't exist
let _ = context.add(".gitmodules");
}
self.in_gitmodules = None;
Ok(())
Expand All @@ -471,7 +472,8 @@ impl Submodule {
if let Some(in_index) = &self.in_index {
println_info!("Deleting `{}` in index", in_index.path);
context.remove_from_index(&in_index.path)?;
context.add(".gitmodules")?;
// add may fail if .gitmodules doesn't exist
let _ = context.add(".gitmodules");
}
self.in_index = None;
Ok(())
Expand Down

0 comments on commit d7468e8

Please sign in to comment.