cargo-generate icon indicating copy to clipboard operation
cargo-generate copied to clipboard

Provide a way to opt out of #166

Open futursolo opened this issue 3 years ago • 2 comments

Since #166, the generated template now has the same default branch name as the generated template. This sometimes can create some issues for templates stored in main branch that matches the code in main branch.

What I want to achieve:

  1. Templates in main branch matches crates in main branch. So GitHub Actions can be run to validate the templates on pull requests.
  2. Templates of the released version is copied to the templates branch by GitHub Actions upon a release. Version numbers inside templates are modified by GitHub Actions automatically by appending to a Rhai script. (I want to leverage the create release page from GitHub to create a release. At that time GitHub already tags the release so templates cannot be modified anymore. It's also a burden for the user to know the latest tag in order to generate from a template.)

However, repositories generated from the templates branch will have their default branch set to templates.

Is it possible to provide a way to specify the default branch name?

e.g.:

[template.vcs]
type = "git"
default_branch = "main"

So doing cargo generate user/project --branch templates will still result in a template with the main branch being created.

futursolo avatar Jan 15 '23 09:01 futursolo

If I understand you correct:

  • given a template repo where templates live in the branch templates
  • you want to ensure that after using this template repo, users will not remain on the templates branch
  • further they instead should have the main as their active branch

is this correct?

And you are suggesting a configuration like so:

[template.vcs]
type = "git"
default_branch = "main"

in the template repo to configure the users "active" branch after they have used your template repo? Right?

sassman avatar May 02 '24 14:05 sassman

@futursolo could you pls provide some clarity?

sassman avatar Jun 12 '24 11:06 sassman