Skip to content

fix(config): Fix scoped config lookups and resolve get() across all scopes - #2037

Merged
CKolkey merged 2 commits into
NeogitOrg:masterfrom
Wikiwix:fix/config-scope-flags
Nov 17, 2026
Merged

CKolkey merged 2 commits into
NeogitOrg:masterfrom
Wikiwix:fix/config-scope-flags

Conversation

@Wikiwix

@Wikiwix Wikiwix commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Fix issues introduced in aa99b44:

  • Resolve user config again
  • Honour includeIf configs
  • Properly resolve config given e.g. via git -c or env vars
  • Let ConfigEntry:refresh() always re-resolve via M.get(), so popup values don't go stale after a local write shadows a global one
  • Add a new spec that checks these changes; 6 of its 7 tests fail on master (This file is fully written by AI, I can remove it if that is preferred)

@Wikiwix
Wikiwix force-pushed the fix/config-scope-flags branch 2 times, most recently from f8652f3 to 60ddeee Compare November 16, 2026 19:51
`get_global` and `get_local` appended `--global`/`--local` after the key,
so `git config --get <key> --global` treated the flag as a value pattern and every lookup came back empty.
This broke e.g. `core.commentChar` in the commit and rebase editors.

- Use the existing `global`/`_local` flags so they precede `--get`.
- Add `--includes` so `include` and `includeIf` sections are honored, which `--global`/`--local` skip by default.
- Tag `get_local` entries with the `local` scope so `ConfigEntry:refresh()` reads the right file.
- Add specs for global, local and `includeIf` lookups.
`M.get()` only consulted `--local` and `--global`,
so values set only in the system config, worktree config or via `git -c` / `GIT_CONFIG_*` were treated as unset,
whereas before aa99b44 the unscoped global fallback picked them up.

- Look up the key without a scope and with `--show-scope`, so git resolves precedence and includes itself and reports where the value came from.
- Let `ConfigEntry:refresh()` re-resolve entries from scopes other than `local`/`global`.
- Add specs for local precedence, system config, environment overrides and missing keys.
@Wikiwix
Wikiwix force-pushed the fix/config-scope-flags branch from 60ddeee to eaf2f50 Compare November 16, 2026 19:54
@Wikiwix

Wikiwix commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

I fixed the type annotation oversights.
Looks like the Test Checks already fail on master: Is there anything to do for me?

@CKolkey
CKolkey merged commit ef0da9b into NeogitOrg:master Nov 17, 2026
3 of 5 checks passed
@CKolkey

CKolkey commented Nov 17, 2026

Copy link
Copy Markdown
Member

thanks :)

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