Skip to content

Commit

Permalink
Merge branch 'master' into useGitStatusCache
Browse files Browse the repository at this point in the history
Conflicts:
	GitUtils.ps1
  • Loading branch information
cmarcusreid committed Sep 6, 2015
2 parents caed8f3 + ec7ee5d commit 002df86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions GitPrompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ $global:GitPromptSettings = New-Object PSObject -Property @{
WorkingForegroundBrightColor = [ConsoleColor]::Red
WorkingBackgroundColor = $Host.UI.RawUI.BackgroundColor

EnableStashStatus = $false
BeforeStashText = ' ('
BeforeStashBackgroundColor = $Host.UI.RawUI.BackgroundColor
BeforeStashForegroundColor = [ConsoleColor]::Red
AfterStashText = ')'
AfterStashBackgroundColor = $Host.UI.RawUI.BackgroundColor
AfterStashForegroundColor = [ConsoleColor]::Red
StashBackgroundColor = $Host.UI.RawUI.BackgroundColor
StashForegroundColor = [ConsoleColor]::Red

ShowStatusWhenZero = $true

AutoRefreshIndex = $true
Expand Down Expand Up @@ -211,6 +221,12 @@ function Write-GitStatus($status) {
Write-Prompt (" {0}" -f $localStatusSymbol) -BackgroundColor $localStatusBackgroundColor -ForegroundColor $localStatusForegroundColor
}

if ($s.EnableStashStatus -and ($status.StashCount -gt 0)) {
Write-Prompt $s.BeforeStashText -BackgroundColor $s.BeforeStashBackgroundColor -ForegroundColor $s.BeforeStashForegroundColor
Write-Prompt $status.StashCount -BackgroundColor $s.StashBackgroundColor -ForegroundColor $s.StashForegroundColor
Write-Prompt $s.AfterStashText -BackgroundColor $s.AfterStashBackgroundColor -ForegroundColor $s.AfterStashForegroundColor
}

Write-Prompt $s.AfterText -BackgroundColor $s.AfterBackgroundColor -ForegroundColor $s.AfterForegroundColor

if ($WindowTitleSupported -and $s.EnableWindowTitle) {
Expand Down
3 changes: 3 additions & 0 deletions GitUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
$filesModified = @()
$filesDeleted = @()
$filesUnmerged = @()
$stashCount = 0

if($settings.EnableFileStatus -and !$(InDisabledRepository)) {
if ($settings.EnableFileStatusFromCache -eq $null) {
Expand Down Expand Up @@ -147,6 +148,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
} else {
dbg 'Getting status' $sw
$status = git -c color.status=false status --short --branch 2>$null
$stashCount = $null | git stash list 2>$null | measure-object | select -expand Count

dbg 'Parsing status' $sw
$status | foreach {
Expand Down Expand Up @@ -213,6 +215,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
HasWorking = [bool]$working
Working = $working
HasUntracked = [bool]$filesAdded
StashCount = $stashCount
}

dbg 'Finished' $sw
Expand Down

0 comments on commit 002df86

Please sign in to comment.