Skip to content
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

Updating the config file #2903

Closed
kevgo opened this issue Jan 2, 2024 · 2 comments
Closed

Updating the config file #2903

kevgo opened this issue Jan 2, 2024 · 2 comments

Comments

@kevgo
Copy link
Contributor

kevgo commented Jan 2, 2024

When there is a config file, and the user runs a command like git town config push-hook yes, it should update the config file instead of storing this setting in Git metadata. Options for updating the config file:

De-serialize the existing config data structure to TOML.

++ easy to build
++ reliable
-- removes all comments from the file

Search-and-replace the setting in the textual config file content.

++ minimal changes
++ comments get preserved
-- complicated to build, lots of edge cases
-- could fail to update a valid config file if it is formatted funny
-- could leave the configuration file in an invalid state

Variations that we have to deal with:

Nested vs dotted keys:

[branches]
perennials = ["one", "two"]

# vs

branches.perennials = ["one", "two"]
[code-hosting]
platform = "github"

# vs

code-hosting.platform = "github"

Single vs multi-line table:

[branches]
perennials = [
  "one", "two",
]

# vs

[branches]
perennials = [
  "one",
  "two",
]

# vs

branches.perennials = [
  "one",
  "two",
]

Non-options

Don't update the config file, tell the user to do it manually.

++ easy to implement
-- poor UX
-- this option is redundant with the user not asking Git Town to update the file and instead doing it manually
@kevgo kevgo mentioned this issue Jan 2, 2024
5 tasks
@kevgo
Copy link
Contributor Author

kevgo commented Jan 2, 2024

For now, let's assume Git Town users change the config file manually and go with the simple but robust serialization of config data to get something workable out the door. Chances are this will be good enough. We can implement the more sophisticated file saving alternative later.

@kevgo
Copy link
Contributor Author

kevgo commented Jan 5, 2024

Superseded by #2941

@kevgo kevgo closed this as completed Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant