12430: Add comments about the two stages of glob-filtering.
authorTom Clegg <tom@curii.com>
Tue, 30 Apr 2024 15:37:59 +0000 (11:37 -0400)
committerTom Clegg <tom@curii.com>
Tue, 30 Apr 2024 15:37:59 +0000 (11:37 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/crunchrun/copier.go

index 507029b36edfcf49b7037807e365cbf79be54e2f..b411948733cf79d21d6e463ee84ff1d130b99a02 100644 (file)
@@ -79,10 +79,17 @@ func (cp *copier) Copy() (string, error) {
        if err != nil {
                return "", fmt.Errorf("error creating Collection.FileSystem: %v", err)
        }
+
+       // Remove files/dirs that don't match globs (the ones that
+       // were added during cp.walkMount() by copying subtree
+       // manifests into cp.manifest).
        err = cp.applyGlobsToCollectionFS(collfs)
        if err != nil {
                return "", fmt.Errorf("error while removing non-matching files from output collection: %w", err)
        }
+       // Remove files/dirs that don't match globs (the ones that are
+       // stored on the local filesystem and would need to be copied
+       // in copyFile() below).
        cp.applyGlobsToFilesAndDirs()
        for _, d := range cp.dirs {
                err = collfs.Mkdir(d, 0777)
@@ -90,6 +97,7 @@ func (cp *copier) Copy() (string, error) {
                        return "", fmt.Errorf("error making directory %q in output collection: %v", d, err)
                }
        }
+
        var unflushed int64
        var lastparentdir string
        for _, f := range cp.files {