-
Notifications
You must be signed in to change notification settings - Fork 20
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
CachingProjectLoader should respect clone parameters #797
Conversation
@ddgenome Is this in line with what you were thinking? |
I think what’s missing here is the entire set of loading parameters to be considered when using the cache key. Right now only a subset of parameters gets used when caching. |
ok, that makes sense. Let me rework this. |
@timothysparg any chance to get his rebased? |
@cdupuis no problem, will do |
e17cf77
to
48bead9
Compare
@cdupuis should be up to date with master again |
@timothysparg the manual edit of the package.json made it out of sync with the package-lock.json. You can verify by running
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
The package-lock.json issue needs to be addressed. We may want to consider optimizing undefined/null clone option properties.
https://github.com/atomist/automation-client/blob/master/lib/spi/clone/DirectoryManager.ts
params.id.repo, | ||
params.id.branch, | ||
params.id.sha, | ||
params.cloneOptions.keep, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are optional, we may have erroneous cache misses because this approach does not recognize, for example, that alwaysDeep
having a value undefined
or false
is equivalent. This should only be a performance issue, so it could perhaps be addressed later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes, one issue remains.
coerceUndefined(params?.cloneOptions?.keep), | ||
coerceUndefined(params?.cloneOptions?.alwaysDeep), | ||
coerceUndefined(params?.cloneOptions?.noSingleBranch), | ||
coerceUndefined(params?.cloneOptions?.depth), | ||
coerceUndefined(params?.cloneOptions?.detachHead), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach would work for the boolean properties, but not for depth. Perhaps something more direct would be better:
params.cloneOptions?.keep || false,
params.cloneOptions?.alwaysDeep || false,
params.cloneOptions?.noSingleBranch || false,
params.cloneOptions?.depth || 1,
params.cloneOptions?.detachHead || false,
With defaults derived from the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me, will update and revert.
Sanity check - It seems like we can assume in this context that cloneOptions will always be defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it isn't, the ?.
will handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Resolves #729