-
Notifications
You must be signed in to change notification settings - Fork 926
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
bug: failure in GitLab with "Error: fatal: Invalid revision range" #4103
Comments
Okay. #885 (comment) pinpoints the problem. The default And there are exactly 20 commits in my MR. So the solution to my problem is to remove
The proper fix on |
Might be already good to add a comment to the docs first |
* docs: remove GitLab clone depth limitation See #4103 * docs: remove stage config from GitLab Let's keep the example minimal.
Opened an issue in GitLab for long term fix https://gitlab.com/gitlab-org/gitlab/-/issues/474701 |
@abitrolly I think this issue is "resolved", right? There's nothing we could do to prevent this issue on GitLab except the documentation change which happened in a2f27fa. |
@janbiasi is there is a smart way to detect how many commits does MR contain, that would be the best fix to put into docs. The chances that GitLab issue will fix itself are low. |
@abitrolly according to your comment and the GitLab Docs it is 20 - this is also already stated in the docs (see below). Hence my comment to close this issue as we can't do more than document that. commitlint/docs/guides/ci-setup.md Lines 139 to 141 in 0c58997
cc @escapedcat |
@janbiasi the If it is impossible to detect the exact number of commits in GitLab MR, if err.Error() == "Error: fatal: Invalid revision range" && ci == "gitlab"{
if undefined(branch_commits) and len(log) == 20 {
exit("Error: commit XXXXX is out of default GitLab fetch range (20), see https://github.com/conventional-changelog/commitlint/issues/4103 how to increase it")
}
if len(log) < len(branch_commits) {
exec(`git fetch --depth ' + len(branch_commits))
retry
}
} |
@abitrolly each CI handles this differently, so you would need to implement workarounds for each CI and their corresponding git implementation (= not commitlint). As an example; with GitHub you can't request a further depth in commits than specified within checkout action unless your providing a custom GH token with specific access. This would lead to inconsistencies in terms of CI usage, which is more confusing and prone to invalid setups than the current state. Additionaly - at least in my opinion - this is not within the commitlint scope, as the commits are a prerequisite outside of commitlint itself and provided by git. I'd be happy to hear what your opinion is @escapedcat |
Let's close this for now. I more people run into this we can look into it again. |
Steps to Reproduce
I am not sure if it is dup of #885 or not, but I've got this failure here https://gitlab.com/gitlab-community/modelops/applied-ml/code-suggestions/ai-assist/-/jobs/7430104908
Current Behavior
No response
Expected Behavior
Expected actionable error message.
Affected packages
Possible Solution
No response
Context
No response
commitlint --version
i don't know
git --version
i don't know
node --version
v22.5.1
The text was updated successfully, but these errors were encountered: