feat(git): override untracked mode for all repo's

resolves #2454
This commit is contained in:
Jan De Dobbeleer 2022-06-30 06:57:39 +02:00 committed by Jan De Dobbeleer
parent 0b0f119420
commit dc851fcf53
3 changed files with 14 additions and 1 deletions

View file

@ -518,6 +518,11 @@ func (g *Git) getOriginURL(upstream string) string {
func (g *Git) getUntrackedFilesMode() string { func (g *Git) getUntrackedFilesMode() string {
mode := "normal" mode := "normal"
repoModes := g.props.GetKeyValueMap(UntrackedModes, map[string]string{}) repoModes := g.props.GetKeyValueMap(UntrackedModes, map[string]string{})
// make use of a wildcard for all repo's
if val := repoModes["*"]; len(val) != 0 {
mode = val
}
// get the specific repo mode
if val := repoModes[g.realFolder]; len(val) != 0 { if val := repoModes[g.realFolder]; len(val) != 0 {
mode = val mode = val
} }

View file

@ -788,6 +788,13 @@ func TestGitUntrackedMode(t *testing.T) {
"bar": "normal", "bar": "normal",
}, },
}, },
{
Case: "Global mode",
Expected: "-uno",
UntrackedModes: map[string]string{
"*": "no",
},
},
} }
for _, tc := range cases { for _, tc := range cases {

View file

@ -67,7 +67,8 @@ You can set the following properties to `true` to enable fetching additional inf
- fetch_worktree_count: `boolean` fetch worktree count - defaults to `false` - fetch_worktree_count: `boolean` fetch worktree count - defaults to `false`
- fetch_upstream_icon: `boolean` - fetch upstream icon - defaults to `false` - fetch_upstream_icon: `boolean` - fetch upstream icon - defaults to `false`
- untracked_modes: `map[string]string` - map of repo's where to override the default untracked mode (`no` | `normal` | `all`). For example - untracked_modes: `map[string]string` - map of repo's where to override the default untracked mode (`no` | `normal` | `all`). For example
`"untracked_modes": { "/Users/me/repos/repo1": "no" }` - defaults to `normal` for all repo's `"untracked_modes": { "/Users/me/repos/repo1": "no" }` - defaults to `normal` for all repo's. If you want to override for all repo's, use
`*` to set the mode instead of the repo path.
### Icons ### Icons