Skip to content

implement category priorities#32

Open
marinjurjevic wants to merge 1 commit into
kobus-v-schoor:masterfrom
marinjurjevic:feature/add-category-priority
Open

implement category priorities#32
marinjurjevic wants to merge 1 commit into
kobus-v-schoor:masterfrom
marinjurjevic:feature/add-category-priority

Conversation

@marinjurjevic
Copy link
Copy Markdown

Motivation

This PR introduces category priorities. This can be useful when you need to override a common tool setting with machine specific setting. In general, it allows a way to make category take precedence by listing it after another category.

Most people use dotgit restore without explicit category, where common and hostname categories are implicitly added. common category has lowest priority because it's added first. hostname category has highest priority because it is appended last.

For example:

computer=alias,zsh,vim,git

.profile
.profile:computer

.zshenv:zsh
.zshenv:computer

Both of these file configs cause error.

First one is problematic when restoring without explicit category.

$> dotgit restore 
multiple category lists active for .profile: ['common'] and ['computer'] 

Second one fails in similar manner.

$> dotgit restore 
multiple category lists active for .profile: ['zsh'] and ['computer'] 

Implementation

Categories are prioritized based on their order after category list is flattened during activation. This allows fine tuning configurations and having general configs overriden by specific configs.

DISCLAIMER: Code and tests have been generated by AI agent. I've added a sentence do docs more as a placeholder. Maybe cookbook could be expanded with more examples and with more complex filelist examples.

@marinjurjevic marinjurjevic force-pushed the feature/add-category-priority branch from 402ae9f to 776d71c Compare March 3, 2026 16:56
@marinjurjevic marinjurjevic force-pushed the feature/add-category-priority branch from 776d71c to 02c49b8 Compare March 3, 2026 16:58
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