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

feat: use parent type/name to match file moves with identical name/hash #631

Merged
merged 30 commits into from
Jul 23, 2024

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Jul 2, 2024

What does this PR do?

allow identical basename and file hash to match when they have the same type and parent (expanding the key)

What issues does this PR fix or reference?

@W-16150330@
forcedotcom/cli#2945

the first local NUT run for the new test should fail. The next commit includes the fix, which should make the test green.

@mshanemc mshanemc requested a review from a team as a code owner July 2, 2024 23:08
@@ -161,6 +153,11 @@ export class ShadowRepo {
filter: fileFilter(this.packageDirs),
});

// isomorphic-git stores things in unix-style tree. Convert to windows-style if necessary
if (IS_WINDOWS) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this needed to be above moveDetection so that all of that code could have deterministic paths based on the OS (because SDR Resolver is os-dependent)

excludeNonMatchingTypes(isWindows)(registry)(
compareHashes(
await buildMaps(
async ({ added, deleted }: AddedAndDeletedFilenames): Promise<StringMapsForMatches> => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

simplify some functions;
we only need to do resolving once since it happens earlier

);
return { fullMatches: matches, deleteOnly };
}
return { fullMatches: matches, deleteOnly: new Map<string, string>() };
};

/** given a StringMap, resolve the metadata types and return things that having matching type/parent */
const excludeNonMatchingTypes =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

type, parent name and parent type are now part of the key. So all this is moot

@mshanemc mshanemc changed the title test: sample project for matching hash moves feat: use parent type/name to match file moves with identical name/hash Jul 19, 2024
Copy link
Contributor

@iowillhoit iowillhoit left a comment

Choose a reason for hiding this comment

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

Code review looks good

@iowillhoit iowillhoit merged commit 863a8f0 into main Jul 23, 2024
33 checks passed
@iowillhoit iowillhoit deleted the sm/identical-file-move-detection branch July 23, 2024 16:05
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.

3 participants