From 7da0ed3125c1f62c6011f31a0b0b218e295112b8 Mon Sep 17 00:00:00 2001 From: Kevin Shaw Date: Tue, 31 Jan 2017 12:59:13 -0800 Subject: [PATCH 1/3] Add AbbreviateHomeDirectory setting Adds a setting to optionally disable the home directory abbreviation in the prompt. By default, this is set to true, preserving the existing behavior. --- src/GitPrompt.ps1 | 2 ++ src/posh-git.psm1 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GitPrompt.ps1 b/src/GitPrompt.ps1 index 6d9184380..86f8da2e4 100644 --- a/src/GitPrompt.ps1 +++ b/src/GitPrompt.ps1 @@ -101,6 +101,8 @@ $global:GitPromptSettings = [pscustomobject]@{ DefaultPromptDebugSuffix = ' [DBG]$(''>'' * ($nestedPromptLevel + 1)) ' DefaultPromptEnableTiming = $false + AbbreviateHomeDirectory = $true + Debug = $false BranchNameLimit = 0 diff --git a/src/posh-git.psm1 b/src/posh-git.psm1 index c58a14e44..a71289043 100644 --- a/src/posh-git.psm1 +++ b/src/posh-git.psm1 @@ -66,7 +66,7 @@ if (!$currentPromptDef -or ($currentPromptDef -eq $defaultPromptDef)) { } # Abbreviate path by replacing beginning of path with ~ *iff* the path is in the user's home dir - if ($currentPath -and $currentPath.StartsWith($Home, $stringComparison)) + if ($GitPromptSettings.AbbreviateHomeDirectory -and $currentPath -and $currentPath.StartsWith($Home, $stringComparison)) { $currentPath = "~" + $currentPath.SubString($Home.Length) } From ccccd7b4dd38604f254273070f56f596861b94ae Mon Sep 17 00:00:00 2001 From: Kevin Shaw Date: Tue, 31 Jan 2017 13:37:24 -0800 Subject: [PATCH 2/3] Change 'AbbreviateHomeDirectory' to 'DefaultPromptHomeDirectory' Pull request comments requested this change. --- src/GitPrompt.ps1 | 3 +-- src/posh-git.psm1 | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/GitPrompt.ps1 b/src/GitPrompt.ps1 index 86f8da2e4..6e8a5139b 100644 --- a/src/GitPrompt.ps1 +++ b/src/GitPrompt.ps1 @@ -100,8 +100,7 @@ $global:GitPromptSettings = [pscustomobject]@{ DefaultPromptSuffix = '$(''>'' * ($nestedPromptLevel + 1)) ' DefaultPromptDebugSuffix = ' [DBG]$(''>'' * ($nestedPromptLevel + 1)) ' DefaultPromptEnableTiming = $false - - AbbreviateHomeDirectory = $true + DefaultPromptAbbreviateHomeDirectory = $true Debug = $false diff --git a/src/posh-git.psm1 b/src/posh-git.psm1 index a71289043..1d6ca41fe 100644 --- a/src/posh-git.psm1 +++ b/src/posh-git.psm1 @@ -66,7 +66,7 @@ if (!$currentPromptDef -or ($currentPromptDef -eq $defaultPromptDef)) { } # Abbreviate path by replacing beginning of path with ~ *iff* the path is in the user's home dir - if ($GitPromptSettings.AbbreviateHomeDirectory -and $currentPath -and $currentPath.StartsWith($Home, $stringComparison)) + if ($GitPromptSettings.DefaultPromptAbbreviateHomeDirectory -and $currentPath -and $currentPath.StartsWith($Home, $stringComparison)) { $currentPath = "~" + $currentPath.SubString($Home.Length) } From 7c3a03f54faa02eee81ffc9410732e9133ac8a62 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Wed, 1 Feb 2017 09:43:48 -0700 Subject: [PATCH 3/3] Change DPAbbrevHomeDirectory default to false. --- src/GitPrompt.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitPrompt.ps1 b/src/GitPrompt.ps1 index 6e8a5139b..001c0f642 100644 --- a/src/GitPrompt.ps1 +++ b/src/GitPrompt.ps1 @@ -100,7 +100,7 @@ $global:GitPromptSettings = [pscustomobject]@{ DefaultPromptSuffix = '$(''>'' * ($nestedPromptLevel + 1)) ' DefaultPromptDebugSuffix = ' [DBG]$(''>'' * ($nestedPromptLevel + 1)) ' DefaultPromptEnableTiming = $false - DefaultPromptAbbreviateHomeDirectory = $true + DefaultPromptAbbreviateHomeDirectory = $false Debug = $false