detached 19525f0

fix(config): use ordered writer in migrate command

commit
19525f0fa89d79578ee96fafdd704101ef9dd522
author
brice · · 2026-01-24 08:05 UTC
parent
f21fa3f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +8 -2
M internal/infrastructure/config/migrate.go +8 -2
@@ -420,8 +420,14 @@ func (m *Migrator) Migrate() ([]string, error) {
420420 return nil, fmt.Errorf("failed to merge config: %w", err)
421421 }
422422
423- // Write the merged config back
424- if err := userViper.WriteConfig(); err != nil {
423+ // Unmarshal to Config struct for ordered writing
424+ var cfg Config
425+ if err := userViper.Unmarshal(&cfg); err != nil {
426+ return nil, fmt.Errorf("failed to unmarshal merged config: %w", err)
427+ }
428+
429+ // Write with ordered sections
430+ if err := WriteConfigOrdered(&cfg, configFile); err != nil {
425431 return nil, fmt.Errorf("failed to write config file: %w", err)
426432 }
427433
@@ -420,8 +420,14 @@ func (m *Migrator) Migrate() ([]string, error) {
420 return nil, fmt.Errorf("failed to merge config: %w", err)420 return nil, fmt.Errorf("failed to merge config: %w", err)
421 }421 }
422 422
423- // Write the merged config back423+ // Unmarshal to Config struct for ordered writing
424- if err := userViper.WriteConfig(); err != nil {424+ var cfg Config
425+ if err := userViper.Unmarshal(&cfg); err != nil {
426+ return nil, fmt.Errorf("failed to unmarshal merged config: %w", err)
427+ }
428+
429+ // Write with ordered sections
430+ if err := WriteConfigOrdered(&cfg, configFile); err != nil {
425 return nil, fmt.Errorf("failed to write config file: %w", err)431 return nil, fmt.Errorf("failed to write config file: %w", err)
426 }432 }
427 433

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close