-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Add support for source git-repos where the template is located in a subdirectory #1571
Comments
This is answered in the docs: https://copier.readthedocs.io/en/latest/configuring/#subdirectory
Looks like a duplicate of #315 #1078 #1279. See especially #315 (comment). I'm closing this issue, but feel free to continue the discussion. |
Hiya @sisp I want to clarify my use-case is basically 1 Template = 1 Git repo Our branching strategy just discourages making changes to the root directory, so I'd like to add the template to a sub-directory. |
@nickgarber And having only |
Right, I think I'll eat the frog and pursue that approach. Thanks for your guidance! |
Hi there! Thanks for this proposal. The feature has been asked many times as you can see. However, none of the solutions had in mind important features such as updating and migrations. The main problem was that git tags are repo-global, so by using branches copier would lose those features. The monorepo approach you suggest is the 1st proposal that could actually work. By changing the src url directly, we get a canonical path where to search for updates. Since all can be done still in the same branch, we can still rely on tags. Problems still present with that approach:
Benefits:
Due to my limited time availability lately, I will be honest: I will not develop this. However, if @copier-org/maintainers agree, we can reopen and leave it as proposed for community contribution. Although it probably requires more gymnastics depending on your case, you can already get it with the workaround suggested. So, do you still think it's worth it @nickgarber? Would you be willing to push a PR? |
Appreciate it! I've taken some time to consider and would be interested to create a draft implementation. I think monorepo users the world over would thank us. Is there still a warm feeling towards reviewing a proposal in support of per source branch encoded templates? |
No, copier considers a repo a template. This is because copier uses tags to compute migrations, and tags are repo-wide, not branch-specific. Thus, we can't rely on branches for the auto-updating. Yes, you can use branches, as long as you always specify |
Actual Situation
We use a monorepo branching strategy where the root directory is shared and kept in common among multiple branches.
In this strategy, there is only one solution per branch and it's added into a distinct subdirectory.
Desired Situation
I'd like to maintain Copier templates, one per branch, but can't seem to identify a way to indicate the subdirectory that each template should be found in. If this isn't already possible, could it be added?
Many thanks for the project!
Proposed solution
It brings to mind the
?dir=<subdir-path>
git-url suffix used by Kustomize to specify a file or directory path within a git repo.Something like that would be a nice addition to the project and elegantly remove this seemingly arbitrary template-placement restriction.
The text was updated successfully, but these errors were encountered: