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

Add computeSha1 option #7345

Merged
merged 1 commit into from
Nov 9, 2018
Merged

Conversation

rubennorte
Copy link
Contributor

Summary

The HasteMap class has an option to compute the sha-1 of files and use it to determine if a file has changed if the modification times differ. This is used by external packages (e.g. Metro) but the option wasn't exposed in Jest. It's exposed as an option instead of enabling it by default because it has a performance impact that only pays off for some use cases (like remote caching, where mtimes differ).

Test plan

This is difficult to test e2e (as it'll mostly be used with watchman and remote caching where mtime is lost) and we don't test that options are forwarded in the different packages in unit tests, so I trust Flow typing and manual testing here.

@SimenB
Copy link
Member

SimenB commented Nov 8, 2018

Related to #7124?

EDIT: No, that's access time, not modified time

@rubennorte rubennorte force-pushed the add-compute-sha1-option branch from ea9d969 to ad0f335 Compare November 8, 2018 23:46
@rubennorte rubennorte force-pushed the add-compute-sha1-option branch from ad0f335 to 0dbf46e Compare November 8, 2018 23:55
@rubennorte rubennorte merged commit 2c18a53 into jestjs:master Nov 9, 2018
@rubennorte rubennorte deleted the add-compute-sha1-option branch November 9, 2018 01:19
@cpojer
Copy link
Member

cpojer commented Dec 3, 2018

Can you explain why this option was added? How do you expect this to be used?

@rubennorte
Copy link
Contributor Author

This option was added to be able to reuse haste map entries for files whose mtime has changed but the sha-1 has not. It basically allows us to use remote caching relying on the actual contents of the file rather than its state in the current filesystem.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants