Skip to content

Commit

Permalink
fix: Fix git fatal error with submodules.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Nov 28, 2024
1 parent cc0cbb4 commit 74cf739
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

#### 🐞 Fixes

- Fixed a Git "fatal: bad object" error when submodules are in being used.

## 1.30.0

#### 💥 Breaking
Expand Down Expand Up @@ -47,7 +53,8 @@

- Fixed `moon project-graph <id>` not including all dependencies/dependents. It was only showing
direct relationships.
- Fixed an issue where touched file paths would include Git submodule directories and trigger hasher warnings.
- Fixed an issue where touched file paths would include Git submodule directories and trigger hasher
warnings.

#### ⚙️ Internal

Expand Down
2 changes: 1 addition & 1 deletion crates/app/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async fn generate_action_graph(

let mut action_graph_builder = session.build_action_graph(workspace_graph).await?;
action_graph_builder.set_touched_files(touched_files)?;
action_graph_builder.set_affected_scopes(UpstreamScope::Direct, DownstreamScope::Deep)?;
action_graph_builder.set_affected_scopes(UpstreamScope::Direct, DownstreamScope::Direct)?;

// Run dependents to ensure consumers still work correctly
action_graph_builder.run_from_requirements(RunRequirements {
Expand Down
14 changes: 9 additions & 5 deletions crates/vcs/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,15 @@ impl Vcs for Git {
) -> miette::Result<TouchedFiles> {
let mut touched_files = TouchedFiles::default();

for result in futures::future::try_join_all(
self.modules
.values()
.map(|module| self.exec_diff(module, base_revision, revision)),
)
// TODO: Revisit submodules
// https://github.com/moonrepo/moon/issues/1734
for result in futures::future::try_join_all(self.modules.values().filter_map(|module| {
if module.is_root() {
Some(self.exec_diff(module, base_revision, revision))
} else {
None
}
}))
.await?
{
touched_files.merge(result);
Expand Down

0 comments on commit 74cf739

Please sign in to comment.