Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman committed Jan 29, 2024
1 parent 6cf2215 commit 110c078
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/turborepo-scm/src/manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ pub(crate) fn get_package_file_hashes_without_git<S: AsRef<str>>(
let relative_path = full_package_path.anchor(path)?;
let relative_path = relative_path.to_unix();

// if we have includes and this path doesn't match any of them, skip it
// if we have includes, and this path doesn't match any of them, skip it
if let Some(include_pattern) = include_pattern.as_ref() {
if !include_pattern.is_match(relative_path.as_str()) {
continue;
}
}

// if we have excludes and this path matches any of them, skip it
// if we have excludes, and this path matches one of them, skip it
if let Some(exclude_pattern) = exclude_pattern.as_ref() {
if exclude_pattern.is_match(relative_path.as_str()) {
continue;
Expand Down
16 changes: 11 additions & 5 deletions crates/turborepo-scm/src/package_deps.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, str::FromStr};
use std::{collections::HashMap, hash::Hash, str::FromStr};

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Go Unit Tests (ubuntu, self-hosted, linux, x64, metal)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (ubuntu, self-hosted, linux, x64, metal)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Go Unit Tests (macos-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (macos, macos-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Go Unit Tests (windows-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (windows, windows-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (ubuntu-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (Go Fallback) (ubuntu-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (Go Fallback) (macos-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (macos-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (windows-latest)

unused import: `hash::Hash`

Check warning on line 1 in crates/turborepo-scm/src/package_deps.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (Go Fallback) (windows-latest)

unused import: `hash::Hash`

use globwalk::ValidatedGlob;
use tracing::debug;
Expand Down Expand Up @@ -135,7 +135,7 @@ impl Git {
}

// we have inputs, and $TURBO_DEFAULT$
self.get_package_file_hashes_from_inputs_and_index(turbo_root, package_path, inputs, true)
self.get_package_file_hashes_from_inputs_and_index(turbo_root, package_path, inputs)
}

#[tracing::instrument(skip(self, turbo_root))]
Expand Down Expand Up @@ -249,7 +249,6 @@ impl Git {
turbo_root: &AbsoluteSystemPath,
package_path: &AnchoredSystemPath,
inputs: &[S],
include_configs: bool,
) -> Result<GitHashes, Error> {
// collect the default files and the inputs
let default_file_hashes =
Expand All @@ -267,10 +266,17 @@ impl Git {
includes.push(input_str);
}
}
// we have to always run the includes search because we add default files to the
// includes
let manual_includes_hashes =
self.get_package_file_hashes_from_inputs(turbo_root, package_path, &includes, true)?;
let manual_excludes_hashes =
self.get_package_file_hashes_from_inputs(turbo_root, package_path, &excludes, false)?;

// only run the excludes search if there are excludes
let manual_excludes_hashes = if !excludes.is_empty() {
self.get_package_file_hashes_from_inputs(turbo_root, package_path, &excludes, false)?
} else {
GitHashes::new()
};

// merge the two includes
let mut hashes = default_file_hashes;
Expand Down

0 comments on commit 110c078

Please sign in to comment.