Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

feat(git-clone): custom destination folder name #287

Merged
merged 5 commits into from
Sep 1, 2024

Conversation

MeguminSama
Copy link
Contributor

@MeguminSama MeguminSama commented Aug 29, 2024

Currently, repositories are always cloned into a folder named after the repo URL.

For example, if you clone git@github.com:coder/modules.git, it'll be cloned into a folder called modules.

This PR adds a new attribute, folder_name. When provided, this name will be used as the destination folder.

In this example, coder will be cloned into ~/projects/coder/coder-dev, where previously it would've been cloned into ~/projects/coder/coder:

module "git-clone" {
  source      = "registry.coder.com/modules/git-clone/coder"
  version     = "1.0.12"
  agent_id    = coder_agent.example.id
  url         = "https://github.com/coder/coder"
  folder_name = "coder-dev"
  base_dir    = "~/projects/coder"
}

Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

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

Thank you for the Contribution. Can you also add a test for this?

@MeguminSama
Copy link
Contributor Author

Sure thing, give me a bit :)

@MeguminSama
Copy link
Contributor Author

The PR doesn't touch much code, but please let me know if you think there are other tests I should perform (cloning over https, different provider, etc.)

@matifali
Copy link
Member

Thank you @MeguminSama, for the contribution.

@matifali matifali merged commit 236022f into coder:main Sep 1, 2024
2 checks passed
@MeguminSama MeguminSama deleted the feat/git-clone/custom-dest-folder branch September 2, 2024 22:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants