-
Notifications
You must be signed in to change notification settings - Fork 343
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 ci --fetch-depth
, deprecate ci --unshallow
#1233
Conversation
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.
@deepyaman looks good so far
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.
@deepyaman sorry for the delay. I have done some testing and identified a few issues.
Additionally @iterative/cml I'm not sure what or if its because GitHub Actions way that the action/checkout
clones repos but providing a non-0 value doesn't result in the expected behavior... see here: https://github.com/iterative/cml-playground/actions/runs/3315755706/jobs/5476740449#step:5:2, however, running this locally does work as expected.
Co-authored-by: Daniel Barnes <[email protected]>
No worries, and thanks for the comments! I've gone ahead and applied the requested changes. |
src/cml.js
Outdated
@@ -474,10 +475,13 @@ class CML { | |||
await exec(await driver.updateGitConfig({ userName, userEmail, remote })); | |||
if (unshallow) { | |||
if ((await exec('git rev-parse --is-shallow-repository')) === 'true') { | |||
await exec('git fetch --unshallow'); | |||
return await exec('git fetch --unshallow'); |
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.
isn't this better?
return await exec('git fetch --unshallow'); | |
fetchDepth = 0; |
Also do we need to add git rev-parse --is-shallow-repository
below?
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.
I don't think so, but I haven't played with this. does git rev-parse --is-shallow-repository
return true
if the depth was already say 3? we wouldn't want to circumvent being able to expand this out directly.
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.
Needed to prevent errors; fixed as part of #1246
Co-authored-by: Casper da Costa-Luis <[email protected]>
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.
@deepyaman with deepyaman#1 we should be good to merge!
Assignment to constant variable
Merged it in, thanks! FWIW when I looked through the code earlier to make a similar change (I think on other PRs), I think most of them just turned the whole block into |
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.
@deepyaman the first version probably didn't re-assign anything, If the linter sees the value is never update it changes it to a const.
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.
also follow-up https://github.com/iterative/cml.dev issue/PR?
@@ -469,15 +469,19 @@ class CML { | |||
userName = GIT_USER_NAME, | |||
remote = GIT_REMOTE | |||
} = opts; | |||
let { fetchDepth = 1 } = opts; |
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.
wait won't this now by default truncate non-shallow clones (as per SO#46004595)?
i.e. cml ci
will now undo actions/checkout.with.fetch-depth: 0
?
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.
it does appear so. I'll do a follow up
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.
Close #975
Development notes
I copied some stuff from https://github.com/actions/checkout/, including the description for the
--fetch-depth
option and the default values/error handling. One thing I didn't copy from there is the floor logic in https://raw.githubusercontent.com/actions/checkout/main/dist/index.js:...but I could?