Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fixed fileutils matching functions #2319

Merged
merged 1 commit into from
Aug 23, 2021

Conversation

aaronlehmann
Copy link
Collaborator

This is important for two reasons:

  1. Keeps caching logic consistent with recent fsutil changes to use
    these functions (also vendored here).

  2. Allows us to move forward with removal of the original buggy Matches
    implementation in moby/moby.

Copy link
Collaborator

@coryb coryb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me. It looks like there were tests added to the upstream PR, but I wonder if we should replicate some of those tests here in checksum_test.go? Minimally it looks like we can add something like this to the end of TestChecksumIncludeDoubleStar:

	dgst, err = cc.Checksum(context.TODO(), ref, "prefix/a", ChecksumOpts{IncludePatterns: []string{"**/foo", "**/report"}}, nil)
	require.NoError(t, err)
	// Now there is a file included
	require.Equal(t, dgstDoubleStar, dgst)

	// Same, with Wildcard = true
	dgst, err = cc.Checksum(context.TODO(), ref, "prefix/a", ChecksumOpts{IncludePatterns: []string{"**/foo", "**/report"}, Wildcard: true}, nil)
	require.NoError(t, err)
	require.Equal(t, dgstDoubleStar, dgst)

where previously we only looked for **/foo/**?

This is important for two reasons:

1) Keeps caching logic consistent with recent fsutil changes to use
   these functions (also vendored here).

2) Allows us to move forward with removal of the original buggy Matches
   implementation in moby/moby.

Signed-off-by: Aaron Lehmann <[email protected]>
@aaronlehmann aaronlehmann force-pushed the use-fixed-matching-functions branch from 9872d46 to 8021a3e Compare August 21, 2021 18:17
@aaronlehmann
Copy link
Collaborator Author

Minimally it looks like we can add something like this to the end of TestChecksumIncludeDoubleStar...

Done.

Copy link
Collaborator

@coryb coryb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aaronlehmann
Copy link
Collaborator Author

@tonistiigi: Is this okay to merge?

@tonistiigi tonistiigi merged commit f314c4b into moby:master Aug 23, 2021
@aaronlehmann aaronlehmann deleted the use-fixed-matching-functions branch August 23, 2021 22:13
@crazy-max crazy-max added this to the v0.10.0 milestone Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants