Skip to content

feat: add --depth to git-clone module to support shallow clones #197

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

Merged
merged 5 commits into from
Jul 10, 2025

Conversation

EdwardAngert
Copy link
Contributor

@EdwardAngert EdwardAngert commented Jul 9, 2025

Description

Adds support for a depth variable to the git-clone module. If a repo is large, a shallow clone makes the git clone a lot faster

Type of Change

  • New module
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/coder/modules/git-clone
New version: v1.0.19 ?
Breaking change:

  • Yes
  • No

Testing & Validation

  • Tests pass (bun test)

  • Code formatted (bun run fmt)

  • Changes tested locally

  • bun test - I don't know if this is expected

    ✗ git-clone > fails without git [298.14ms]
    ✗ git-clone > runs with git [289.14ms]
    ✗ git-clone > runs with github clone with switch to feat/branch [277.19ms]
    ✗ git-clone > runs with gitlab clone with switch to feat/branch [293.49ms]
    ✗ git-clone > runs with github clone with branch_name set to feat/branch [288.07ms]

Related Issues

None

@matifali matifali requested a review from DevelopmentCats July 9, 2025 08:06
@DevelopmentCats
Copy link
Contributor

@EdwardAngert

✗ git-clone > fails without git [298.14ms]
✗ git-clone > runs with git [289.14ms]
✗ git-clone > runs with github clone with switch to feat/branch [277.19ms]
✗ git-clone > runs with gitlab clone with switch to feat/branch [293.49ms]
✗ git-clone > runs with github clone with branch_name set to feat/branch [288.07ms]

These tests fail because the default timeout for a bun test is like 5 seconds. The Git Runner is efficient enough to never generally timeout, but if you ever have issues like this you can add --timeout 30000 after the bun test -t 'module' command

Also its good practice to run bun fmt in the branch before submitting a PR so that way the linting test passes.

@DevelopmentCats
Copy link
Contributor

@EdwardAngert Just checking have you tested this locally? If not ill test it tonight as well and get it pushed.

@EdwardAngert
Copy link
Contributor Author

@DevelopmentCats I haven't! I threw it together last night because I realized it might work, then got caught up in things today

if you can, that'd be wonderful 🙌

@DevelopmentCats
Copy link
Contributor

@DevelopmentCats I haven't! I threw it together last night because I realized it might work, then got caught up in things today

if you can, that'd be wonderful 🙌

It's all good. I honestly don't see how it wouldn't work since it's just adding the depth param to the one liner git command. But you never know 😝

Copy link
Contributor

@DevelopmentCats DevelopmentCats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and its working perfectly.

@DevelopmentCats DevelopmentCats added the version:minor Add to PRs requiring a minor version upgrade label Jul 10, 2025
@coder coder deleted a comment from github-actions bot Jul 10, 2025
@DevelopmentCats DevelopmentCats merged commit 0a3c9b0 into main Jul 10, 2025
4 of 5 checks passed
@DevelopmentCats DevelopmentCats deleted the git-clone-depth branch July 10, 2025 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version:minor Add to PRs requiring a minor version upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants