Permalink
Browse files

Add $GitPromptSettings.Debug instead of relying on $DebugPreference

  • Loading branch information...
dahlbyk committed Dec 18, 2010
1 parent 7b9073b commit f544c4cad6a9ca9aa264d76f6a62fdbef00eb090
Showing with 7 additions and 3 deletions.
  1. +2 −0 GitPrompt.ps1
  2. +2 −2 GitUtils.ps1
  3. +3 −1 Utils.ps1
View
@@ -40,6 +40,8 @@ $global:GitPromptSettings = New-Object PSObject -Property @{
EnablePromptStatus = $true
EnableFileStatus = $true
+
+ Debug = $false
}
function Write-GitStatus($status) {
View
@@ -72,7 +72,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
$enabled = (-not $settings) -or $settings.EnablePromptStatus
if ($enabled -and $gitDir)
{
- $sw = [Diagnostics.Stopwatch]::StartNew()
+ if($settings.Debug) { $sw = [Diagnostics.Stopwatch]::StartNew(); Write-Host '' }
$branch = $null
$aheadBy = 0
$behindBy = 0
@@ -152,7 +152,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
}
dbg 'Finished' $sw
- $sw.Stop()
+ if($sw) { $sw.Stop() }
return $result
}
}
View
@@ -29,5 +29,7 @@ function Get-LocalOrParentPath($path) {
}
function dbg ($Message, [Diagnostics.Stopwatch]$Stopwatch) {
- Write-Debug ('{0:00000}:{1}' -f $Stopwatch.ElapsedMilliseconds,$Message)
+ if($Stopwatch) {
+ Write-Verbose ('{0:00000}:{1}' -f $Stopwatch.ElapsedMilliseconds,$Message) -Verbose # -ForegroundColor Yellow
+ }
}

0 comments on commit f544c4c

Please sign in to comment.