-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
For some of lazygit's config options it would be good to have different settings for different repos; some examples are:
git.commit.signOff
(true only in those open-source repos that require it)git.commit.wrapCommitMessageAt
(if/when we merge Auto-wrap commit message while typing #3173)git.log.order
(which you may want to set to 'top-order' for most repos, but to 'default' for the really huge ones, for performance reasons)
It would also allow us to get rid of the weird git.commitPrefixes
map and have a single git.commitPrefix
setting.
The obvious way to support this is to allow a local config file in the git repo that overrides the global one, much like git itself does it with ~/.gitconfig
vs. .git/config
.
There are two possible options where we could put the file:
- in the
.git
folder (.git/lazygit.yml
) - in the working copy (
./.lazygit.yml
)
Some considerations for each:
- makes it per-repo, so it applies to all worktrees that are attached to the repo.
- it feels a bit strange to put third-party things into git's private folder, but it seems to be ok, judging from the responses to this mailing list thread
- if users throw away their working copy and re-clone, the settings are lost. But so are the ones of git itself, so I guess that's ok.
- makes it per-worktree, which I suppose is less desirable than per-repo in most cases
- users can decide whether they want to version it (which makes it per-repo again...), or add it to
.gitignore
- it is similar to
.vscode/settings.json
- creates a security vulnerability unless we make sure that custom commands or editor configs can't be read from this file
- users can decide whether they want to version it (which makes it per-repo again...), or add it to
If we don't want to make the decision, we could also read files from both locations and let the user decide where to put it. But then we at least need to define the precedence.
Another alternative might be to put custom lazygit configs into git's config file; this is the approach that git gui takes. Since git uses the init format, they would have to be translated to yaml from there, which I'm not sure is always possible. I find this approach less promising for us.