how do I delete a file from a `Digest`? I am tryin...
# development
f
how do I delete a file from a
Digest
? I am trying to use syntax like the following to do so:
Copy code
sources_digest = await Get(Digest, DigestSubset(sources_digest, PathGlobs(["!__sources__/go.sum", "**"])))
but I still get an error in
MergeDigests
about conflicting files later
h
what's the snapshot showing if you upcast the Digest to Snapshot? That's what I would expect to do
f
dumping the snapshot shows that
__sources_/go.sum
is still in the digest
hmm I guess I need
GlobExpansionConjunction.all_match
?
that didn’t work 😞
and setting the error behavior to error didn’t fail either
h
Totally plausible
DigestSubset
code is broken in Rust
f
["!**/go.sum", "__sources__/**"]
works but just
**
for the second glob didn’t work since go.sum was included in that case
h
Huh. what about
["!__sources/go.sum", __sources__/**"]
?
f
fails [merging the digests later]
never mind, that works once I fix the typo in the first glob from what I copy/pasted from your message
👍 1
h
So, this fails when using
**
but not
__sources__/**
, interesting
f
seems so
h
seems like a bug in Rust code. If you are able to workaround and don't have time to fix, could open an issue and punt. But would be great to fix if you have the time
f
I just have time to write a failing test for it.
👍 1
h
Thanks! That with an issue would be great
c
Out of curiosity, does this look like a correct assertion for this?
Copy code
$ git diff
diff --git a/src/rust/engine/fs/store/src/snapshot_ops_tests.rs b/src/rust/engine/fs/store/src/snapshot_ops_tests.rs
index f63575f8f..7361d6487 100644
--- a/src/rust/engine/fs/store/src/snapshot_ops_tests.rs
+++ b/src/rust/engine/fs/store/src/snapshot_ops_tests.rs
@@ -95,7 +95,7 @@ async fn subset_single_files() {
 async fn subset_recursive_wildcard() {
   let (store, tempdir, posix_fs, digester) = setup();
 
-  let (merged_digest, _, _) = get_duplicate_rolands(
+  let (merged_digest, snapshot1, _) = get_duplicate_rolands(
     store.clone(),
     store.clone(),
     tempdir.path(),
@@ -120,6 +120,15 @@ async fn subset_recursive_wildcard() {
     .await
     .unwrap();
   assert_eq!(merged_digest, subset_roland2);
+
+  // ** should not include explicitly excluded files
+  let subset_params3 = make_subset_params(&["!subdir/roland2", "**"]);
+  let subset_roland3 = store
+    .clone()
+    .subset(merged_digest, subset_params3)
+    .await
+    .unwrap();
+  assert_eq!(subset_roland3, snapshot1.digest);
 }
It fails, at least 😛
Copy code
$ ./cargo test -p store subset
   Compiling store v0.1.0 (/Users/aadt/src/github/kaos/pants/src/rust/engine/fs/store)
    Finished test [unoptimized + debuginfo] target(s) in 8.02s
     Running unittests (target/debug/deps/store-7c3fe3b7432a3083)

running 3 tests
test snapshot_ops_tests::subset_tracking_load_counts ... ok
test snapshot_ops_tests::subset_single_files ... ok
test snapshot_ops_tests::subset_recursive_wildcard ... FAILED

failures:

---- snapshot_ops_tests::subset_recursive_wildcard stdout ----
thread 'snapshot_ops_tests::subset_recursive_wildcard' panicked at 'assertion failed: `(left == right)`
  left: `Digest { hash: Fingerprint<5ef2cabce63f0f081e2f6408900977366d5ae425510afe8e90b5f2a4d0f488fa>, size_bytes: 81 }`,
 right: `Digest { hash: Fingerprint<eba4e5b1d239770d5a452a829ba4949cec691e7ff2e2805fd1e9123fe349fe62>, size_bytes: 80 }`', fs/store/src/snapshot_ops_tests.rs:131:3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    snapshot_ops_tests::subset_recursive_wildcard

test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 108 filtered out; finished in 0.12s
I didn’t find a issue yet in github regarding this…
but I’m off now, see you tomorrow…
I beleive this is in the right direction, at least.. 😉 https://github.com/pantsbuild/pants/pull/12648
f