1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-21 04:25:53 +03:00

16 Commits

Author SHA1 Message Date
Chris McDonnell
d39f883b4e Migrate to only doing marshalling twice, and compare via deep copy 2025-02-27 17:05:31 -05:00
Stefan Haller
87c3e75811 Use indentation of 2 when rewriting auto-migrated config file
This seems to be what most people use when indenting yaml files, and it seems to
make more sense than the default of 4.

We also use it the example config in Config.md.
2025-02-23 11:32:12 +01:00
Chris McDonnell
2fa4ee2cac feat: Support multiple commit prefixes
This implementation, unlike that proposed in https://github.com/jesseduffield/lazygit/pull/4253
keeps the yaml schema easy, and does a migration from the single
elements to a sequence of elements.
2025-02-17 19:58:31 +01:00
Jesse Duffield
fdff2dec79 Remove redundant variable dedeclarations
In go 1.22, loop variables are redeclared with each iteration of the
loop, rather than simple updated on each iteration. This means that we
no longer need to manually redeclare variables when they're closed over
by a function.
2024-05-19 16:38:21 +10:00
Stefan Haller
84e82ea8b6 fixup! Introduce a yaml_utils.Walk function 2024-03-30 13:05:33 +01:00
Stefan Haller
4d8b8b647a Introduce a yaml_utils.Walk function 2024-03-29 17:55:06 +01:00
Stefan Haller
c4a2749a99 Avoid rewriting the file if nothing changed
This avoids changing the indentation or number of blank lines etc unnecessarily
if nothing has changed.
2023-06-26 08:11:10 +02:00
Stefan Haller
85f293af1a Add new function RenameYamlKey 2023-06-26 08:11:10 +02:00
Stefan Haller
4461dc68b7 Create missing path elements
This fixes a serious error: trying to change a value on gui.someOption would add
a someOption key at root if gui doesn't exist.
2023-06-26 08:11:10 +02:00
Stefan Haller
6acabba417 Return an error if some node in the path is not a dictionary 2023-06-26 08:11:10 +02:00
Stefan Haller
7fb86d6e9c Return an error if node to be updated is not a scalar 2023-06-26 08:11:10 +02:00
Stefan Haller
221433522d Return an error if document is not a dictionary 2023-06-26 08:11:10 +02:00
Stefan Haller
90084d115e Support updating values in empty documents 2023-06-26 08:11:10 +02:00
Stefan Haller
a14794bf5c Rename UpdateYaml to UpdateYamlValue
We are going to add other ways to update yaml documents in the future.
2023-06-26 08:11:10 +02:00
Stefan Haller
bf685cf832 Cleanup: improve test setup and check for the right error string
Use the assert package to check expectations; also, check for the exact error
message instead of just whether any error occurred.
2023-06-26 08:11:10 +02:00
Jesse Duffield
e156e090cc add ability to update yaml path while preserving comments 2023-05-10 22:31:27 +10:00