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

configuration file #2748

Closed
5 tasks done
kevgo opened this issue Dec 8, 2023 · 1 comment
Closed
5 tasks done

configuration file #2748

kevgo opened this issue Dec 8, 2023 · 1 comment
Milestone

Comments

@kevgo
Copy link
Contributor

kevgo commented Dec 8, 2023

The configuration file .git-branches stores long-lived configuration information that is common to all team members. This is part of #1030.

Roadmap

  • basic config file: as an alternative to the Git-based configuration
  • config changes: user changes a config setting
  • command to migrate the Git configuration into a config file
    • We get this for free with the setup assistant. Just run the setup assistant. It reads the Git metadata. Keep all chosen options. Choose "config file" as the config location. The setup assistant writes the config to the file and removes the Git metadata.
  • two configs: Git Town runs with both Git config and config file
    • migrate the Git config into the config file
  • config conflict: Git Town runs with both Git config and config file and the settings disagree with each other
    • Git metadata config takes precedence over the config file

Reasons to use a configuration file:

Configuration files prevents obstacles that teams adopting or using Git Town are facing.

  • configuration can be set up and maintained by one Git Town expert for the entire team
  • configuration is guaranteed to be the same for everybody
  • configuration is visible in clear text to everybody inspecting a repo
  • configuration can be changed in proposals

Git Town only uses the Git configuration because the initial Bash implementation made it hard to parse JSON files, so using the Git configuration was an easy solution. Now that Git Town is written in a proper programming language, let's adopt a more idiomatic way of configuring Git Town.

Examples

For Git Town's simple configuration data, TOML seems the most readable and ergonomic option. JSON is nice because everybody knows it, but it struggles with capitalization, and the indented format looks weird. YML would make sense if the configuration is much more complex. For the simple config data here, it feels too technical.

JSON

{
  "mainBranch": "main",
  "perennialBranches": [ "public" ],
  "codeHostingPlatform": "github",
  "codeHostingOriginHostname": "github.com",
  "pushNewBranches": true,
  "syncFeatureStrategy": "merge",
  "syncPerennialStrategy": "rebase",
  "shipDeleteRemoteBranch": false,
  "syncUpstream": true,  
}
{
  "branches": {
    "main": "main",
    "perennials": ["public"]
  },
  "code-hosting": {
    "platform": "github",
    "origin-hostname": "github.com"
  },
  "sync-strategy": {
    "feature-branches": "merge",
    "perennial-branches": "rebase"
  },
  "pushNewBranches": true,
  "shipDeleteRemoteBranch": false,
  "syncUpstream": true
}

TOML

[branches]
main = "main"
perennials = [ "public" ]

[code-hosting]
platform = "github"
origin-hostname = "github.com"

[sync-strategy]
feature-branches = "merge"
perennial-branches = "rebase"

pushNewBranches = true
shipDeleteRemoteBranch = false
syncUpstream = true
branches.main = "main"
branches.perennials = [ "public" ]
code-hosting.platform = "github"
code-hosting.origin-hostname = "github.com"
sync-strategy.feature-branches = "merge"
sync-strategy.perennial-branches = "rebase"
pushNewBranches = true
shipDeleteRemoteBranch = false
syncUpstream = true
mainBranch = "main"
perennialBranches = [ "public" ]
codeHostingPlatform = "github"
codeHostingOriginHostname = "github.com"
pushNewBranches = true
syncFeatureStrategy = "merge"
syncPerennialStrategy = "rebase"
shipDeleteRemoteBranch = false
syncUpstream = true

YML

branches:
  main: "main"
  perennials:
    - "public"

code-hosting:
  platform: "github"
  origin-hostname: "github.com"

sync-strategy:
  feature-branches: "merge"
  perennial-branches: "rebase"

pushNewBranches: true
shipDeleteRemoteBranch: false
syncUpstream: true
@kevgo
Copy link
Contributor Author

kevgo commented Dec 8, 2023

TOML parser for Go: https://github.com/BurntSushi/toml

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