-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement shallow repo cloning in merge checkout strategy #2387
Conversation
When the repository is quite large clones are becoming slower. Previously Atlantis fetched full repository in --checkout-strategy=merge mode. However, that's not required, we only should have enough commits in our clone to perform a merge between base and feature branches, not full history. This implements rough guessing: fetch 50 (user-configurable) commits from each of base and feature branches, and if their merge base is not in these commits, fetch full repo history. This is not ideal solution and could be improved (e.g. increase the number of fetched commits in several attempts before full fetch), but I think it should be good enough in most cases.
Huh, come to think of it, implementing cache for git repo would probably be a better solution.
Current PR would still probably be useful in cases when there are tons of files in repo and even cloning from dir to dir takes a long time, but that's more rare scenario. |
@jilyaluk should we close this base on your comments? |
closed as not planned |
Could we reopen this? I think this has a lot of value for repos with many commits |
go for it.
…On Tue, Nov 22, 2022, 9:18 p.m. nitrocode ***@***.***> wrote:
Could we reopen this? I think this has a lot of value for repos with many
commits
—
Reply to this email directly, view it on GitHub
<#2387 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERBDMVEC7IYJB6LXR3DWJWSL5ANCNFSM53PH5H4Q>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
@jamengual i cannot open this for some reason. The branch still exists. The button is unclickable. |
Ah it's because the |
@jilyaluk please resolve conflicts when time permits. We appreciate your patience |
When the repository is quite large clones are becoming slower. Previously Atlantis fetched full repository in --checkout-strategy=merge mode.
However, that's not required, we only should have enough commits in our clone to perform a merge between base and feature branches, not full history.
This implements rough guessing: fetch 50 (user-configurable) commits from each of base and feature branches, and if their merge base is not in these commits, fetch full repo history. This is not ideal solution and could be improved (e.g. increase the number of fetched commits in several attempts before full fetch), but I think it should be good enough in most cases.
I'm not sure about the flag name and enabling this behaviour by default. The flag could be renamed to something like
--checkout-merge-depth
, if that would be preferable. Also, I could change the default value to zero and treat it as "always fetch full repo", to comply with previous behaviour.