Skip to content

Conversation

@jasonwbarnett
Copy link

@jasonwbarnett jasonwbarnett commented Dec 10, 2025

Description

Add a new clone_args variable to the git-clone module that allows users to pass additional arguments to the git clone command.

Use case: We have a large monorepo and embedding a local git mirror in our custom AMI allows us to use --reference /path/to/mirror to dramatically improve clone times. This variable enables that workflow without requiring a fork of the module.

Type of Change

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

Module Information

Path: registry/coder/modules/git-clone
New version: v1.3.0
Breaking change: [ ] Yes [x] No

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun fmt)
  • Changes tested locally

Related Issues

None

🤖 Generated with Claude Code

Jason Barnett and others added 7 commits December 10, 2025 16:46
Allow users to pass additional arguments to the git clone command via a
new `clone_args` variable. This enables use cases like using a local
mirror with `--reference` to speed up cloning large repositories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace nested conditionals with a single git clone call that builds
arguments dynamically using POSIX-compatible `set --` and `$@`. This
reduces code duplication and makes the script easier to maintain.

Also switched shebang from bash to sh for better portability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests covering all combinations of depth, branch_name, and clone_args
to ensure the refactored run.sh properly handles all argument scenarios.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Refactor run.sh to use bash arrays instead of nested conditionals
- Replace 4 separate git clone command variations with a single call
- Update tests to use bitnami/git image (has both bash and git)
- Use debian:stable-slim for "no git" test (has bash without git)
- Update test assertions to use toContain for path flexibility

This simplifies the script while maintaining all functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jasonwbarnett jasonwbarnett force-pushed the jwb/enable-custom-command branch from 6fa37b7 to e89431f Compare December 11, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant