Skip to content

git-repository loads worktree configs #635

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

Merged
merged 14 commits into from
Dec 3, 2022

Conversation

SidneyDouw
Copy link
Contributor

@SidneyDouw SidneyDouw commented Dec 1, 2022

Give git-repository the capability to load worktree specific configuration files, if the appropriate setting (extensions.worktreeConfig) is set in the main config file.

Tasks

  • test fixture that creates multiple worktrees with individual config.worktree files
  • tests that check…
    • …if shared config is being loaded
    • …if worktree config is being loaded
    • …if worktree config overrides shared config settings
  • implement loading of worktree configs in git-repository

Sidney Douw added 9 commits December 1, 2022 11:02
…if worktree configs exist they should always be read
…reuse buffer instead of appending configs
…add shared config entry to the fixture and check it in tests
…because creating worktrees with `git` creates a .git file in the worktree
that points to the git_dir using an absolute path, so every tester has to
generate that fixture from scratch.
…and use CARGO_MANIFEST_DIR instead
@SidneyDouw SidneyDouw mentioned this pull request Dec 2, 2022
17 tasks
Sidney Douw and others added 5 commits December 2, 2022 18:14
…rktree`.

This also resets the original behaviour of reading `$COMMON_DIR/config`
as `Source::Local`.
…:worktree`

As these settings are relevant during opening and aren't queried later
as part of implementations in `repository::config` or `config`.
This is just to keep in-code notes in the form of assertion messages,
after validating each assertion one by one and forcing myself
to understand them.
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot, I absolutely like how spot-on the addition of worktree configuration support is in the bootstrapping sequence of the repository.

As a note and for future reference, it's important to properly classify configuration using their git_config::Source - each section has metadata attached by which it can be filtered and that's relevant to how much we can 'trust' these values.

It's great to see that finally gitoxide is able to properly start up and load everything that matters, laying the ground work for handling massive monorepos correctly soon enough :).


(cd wt-2
git config --worktree worktree.setting "set in wt-2"
git config --worktree override.setting "override in wt-2"
Copy link
Member

Choose a reason for hiding this comment

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

Setting values so they describe their purpose and show up in the tests like this works really well! Thank you.

@Byron Byron merged commit d1b7ec6 into GitoxideLabs:main Dec 3, 2022
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.

2 participants