mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-27 20:09:39 -08:00
parent
5a57d6909d
commit
e0b28bd2c4
|
@ -44,6 +44,8 @@ const (
|
|||
FetchWorktreeCount properties.Property = "fetch_worktree_count"
|
||||
// FetchUpstreamIcon fetches the upstream icon
|
||||
FetchUpstreamIcon properties.Property = "fetch_upstream_icon"
|
||||
// FetchBareInfo fetches the bare repo status
|
||||
FetchBareInfo properties.Property = "fetch_bare_info"
|
||||
|
||||
// BranchIcon the icon to use as branch indicator
|
||||
BranchIcon properties.Property = "branch_icon"
|
||||
|
@ -182,6 +184,9 @@ func (g *Git) shouldDisplay() bool {
|
|||
|
||||
gitdir, err := g.env.HasParentFilePath(".git")
|
||||
if err != nil {
|
||||
if !g.props.GetBool(FetchBareInfo, false) {
|
||||
return false
|
||||
}
|
||||
g.realDir = g.env.Pwd()
|
||||
bare := g.getGitCommandOutput("rev-parse", "--is-bare-repository")
|
||||
if bare == "true" {
|
||||
|
|
|
@ -178,7 +178,9 @@ func TestEnabledInBareRepo(t *testing.T) {
|
|||
g := &Git{
|
||||
scm: scm{
|
||||
env: env,
|
||||
props: properties.Map{},
|
||||
props: properties.Map{
|
||||
FetchBareInfo: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
assert.Equal(t, g.Enabled(), tc.ExpectedEnabled, tc.Case)
|
||||
|
|
|
@ -799,6 +799,12 @@
|
|||
"description": "Display upstream icon or not",
|
||||
"default": false
|
||||
},
|
||||
"fetch_bare_info": {
|
||||
"type": "boolean",
|
||||
"title": "Fetch info when in a bare repo",
|
||||
"description": "Fetch info when in a bare repo or not",
|
||||
"default": false
|
||||
},
|
||||
"branch_icon": {
|
||||
"type": "string",
|
||||
"title": "Branch Icon",
|
||||
|
|
|
@ -73,6 +73,7 @@ You can set the following properties to `true` to enable fetching additional inf
|
|||
| `fetch_stash_count` | `boolean` | fetch stash 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_bare_info` | `boolean` | fetch bare repo info - defaults to `false` |
|
||||
| `untracked_modes` | `map[string]string` | map of repo's where to override the default [untracked files mode][untracked]:<ul><li>`no`</li><li>`normal`</li><li>`all`</li></ul>For example `"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 |
|
||||
| `ignore_submodules` | `map[string]string` | map of repo's where to change the [--ignore-submodules][submodules] flag (`none`, `untracked`, `dirty` or `all`). For example `"ignore_submodules": { "/Users/me/repos/repo1": "all" }`. If you want to override for all repo's, use `*` to set the mode instead of the repo path |
|
||||
| `native_fallback` | `boolean` | when set to `true` and `git.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native git executable to fetch data. Not all information can be displayed in this case. Defaults to `false` |
|
||||
|
@ -142,7 +143,7 @@ You can set the following properties to `true` to enable fetching additional inf
|
|||
| `.StashCount` | `int` | the stash count |
|
||||
| `.WorktreeCount` | `int` | the worktree count |
|
||||
| `.IsWorkTree` | `boolean` | if in a worktree repo or not |
|
||||
| `.IsBare` | `boolean` | if in a bare repo or not |
|
||||
| `.IsBare` | `boolean` | if in a bare repo or not, only set when `fetch_bare_info` is set to `true` |
|
||||
| `.Dir` | `string` | the repository's root directory |
|
||||
| `.Kraken` | `string` | a link to the current HEAD in [GitKraken][kraken-ref] for use in [hyperlinks][hyperlinks] in templates `{{ url .HEAD .Kraken }}` |
|
||||
|
||||
|
|
Loading…
Reference in a new issue