Skip to content

Commit

Permalink
simplify change_detector
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitropoulos committed Aug 22, 2024
1 parent 6c48762 commit d3174b5
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions crates/turborepo-lib/src/run/scope/change_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,23 @@ impl<'a> GitChangeDetector for ScopeChangeDetector<'a> {
include_uncommitted: bool,
allow_unknown_objects: bool,
) -> Result<HashSet<PackageName>, ResolutionError> {
let mut changed_files = HashSet::new();
if !from_ref.map_or(false, |s| s.is_empty()) {
changed_files = match self.scm.changed_files(
self.turbo_root,
from_ref,
to_ref,
include_uncommitted,
allow_unknown_objects,
)? {
ChangedFiles::All => {
debug!("all packages changed");
return Ok(self
.pkg_graph
.packages()
.map(|(name, _)| name.to_owned())
.collect());
}
ChangedFiles::Some(changed_files) => changed_files,
let changed_files = match self.scm.changed_files(
self.turbo_root,
from_ref,
to_ref,
include_uncommitted,
allow_unknown_objects,
)? {
ChangedFiles::All => {
debug!("all packages changed");
return Ok(self
.pkg_graph
.packages()
.map(|(name, _)| name.to_owned())
.collect());
}
}
ChangedFiles::Some(changed_files) => changed_files,
};

let lockfile_contents = self.get_lockfile_contents(from_ref, &changed_files);

Expand Down

0 comments on commit d3174b5

Please sign in to comment.