Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add $GitPromptSettings.EnableFileStatus

  • Loading branch information...
commit fb7c0df39b199fb4fdd4f12f67df73c7e6497d83 1 parent ecce857
@dahlbyk authored
Showing with 11 additions and 5 deletions.
  1. +3 −2 GitPrompt.ps1
  2. +8 −3 GitUtils.ps1
View
5 GitPrompt.ps1
@@ -37,6 +37,7 @@ $global:GitPromptSettings = New-Object PSObject -Property @{
AutoRefreshIndex = $true
EnablePromptStatus = $true
+ EnableFileStatus = $true
}
function Write-GitStatus($status) {
@@ -54,7 +55,7 @@ function Write-GitStatus($status) {
Write-Host $currentBranch -NoNewline -BackgroundColor $s.Branch2BackgroundColor -ForegroundColor $s.Branch2ForegroundColor
}
- if($status.HasIndex) {
+ if($s.EnableFileStatus -and $status.HasIndex) {
write-host $s.BeforeIndexText -NoNewLine -BackgroundColor $s.BeforeIndexBackgroundColor -ForegroundColor $s.BeforeIndexForegroundColor
if($s.ShowStatusWhenZero -or $status.Index.Added) {
@@ -76,7 +77,7 @@ function Write-GitStatus($status) {
}
}
- if($status.HasWorking) {
+ if($s.EnableFileStatus -and $status.HasWorking) {
if($s.ShowStatusWhenZero -or $status.Working.Added) {
Write-Host " +$($status.Working.Added.Count)" -NoNewline -BackgroundColor $s.WorkingBackgroundColor -ForegroundColor $s.WorkingForegroundColor
}
View
11 GitUtils.ps1
@@ -74,7 +74,12 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
$filesDeleted = @()
$filesUnmerged = @()
- $status = git status --short --branch 2>$null
+ if($settings.EnableFileStatus) {
+ $status = git status --short --branch 2>$null
+ } else {
+ $status = @()
+ }
+
$status | where { $_ } | foreach {
switch -regex ($_) {
'^## (?<branch>\S+)(?:\.\.\.(?<upstream>\S+) \[(?:ahead (?<ahead>\d+))?(?:, )?(?:behind (?<behind>\d+))?\])?$' {
@@ -117,7 +122,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
Add-Member -PassThru NoteProperty Deleted $filesDeleted |
Add-Member -PassThru NoteProperty Unmerged $filesUnmerged
- $status = New-Object PSObject -Property @{
+ $result = New-Object PSObject -Property @{
GitDir = $gitDir
Branch = $branch
AheadBy = $aheadBy
@@ -128,7 +133,7 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
HasUntracked = [bool]$filesAdded
}
- return $status
+ return $result
}
}

0 comments on commit fb7c0df

Please sign in to comment.
Something went wrong with that request. Please try again.