Skip to content
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

Prioritize parent project configuration over git configuration #2

Open
mattstruble opened this issue Jun 26, 2023 · 2 comments
Open

Comments

@mattstruble
Copy link

Description

When defining project configurations, I would like to define a project for a specific company root directory, and be able to apply the company's copyright to all child git repos.

Currently, when loading the configuration, it is early exiting as soon as it finds the .git/ folder.

Setup

require("auto-header").setup({
	templates = {
		{
			language = "*",
			prefix = "auto",
			template = {
				require("auto-header").licenses.MIT
			}
		},
	},
	projects = {
		{
			project_name = "My company",
			root = "/home/user/software/company/",
			create = true, 
			update = true, 
			template = {
				"Company Copyright Notice."
			},
			data = {
				cp_holders = "Company <url>"
			}
		}
	}
})

With this config, if you create a repository /home/user/software/company/git-repo/ then when trying to call auto-header with <leader>ah it should apply the company notice.

In the current state, it is applying the MIT license.

Ideal State

The ideal state would be to load both the git config, and the parent project config. With the parent project taking precedence.

@VincentBerthier
Copy link
Owner

I do agree that I should make both the project config and the git one merge.
I’m a bit confused about the script exiting when it finds the git config though since it seems to me to be clearly the opposite: it looks for a project configuration if one is found, it’ll return it (l.70), and only if no existing project configuration is found will it look and return a git one if it exists (l.74).

That being said, if it doesn’t work as it should with the configuration you posted, something is clearly going wrong. I’m just not sure what right now… I’ll have a look.

@VincentBerthier
Copy link
Owner

So I’ve had that look. There were a few things that I needed to fix, but in my tests I cannot reproduce your problem even though I have a very similar setup (a generic copyright notice for the language templates, and the MIT one for the auto-header). The right copyright notice gets inserted in the header.

Can you tell me if you still have this issue?

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

No branches or pull requests

2 participants