Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Untracked and Gone branch color #918

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/GitPrompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ function Get-GitBranchStatusColor {
# We are ahead of remote
$branchStatusTextSpan = [PoshGitTextSpan]::new($s.BranchAheadStatusSymbol)
}
elseif ($Status.UpstreamGone -eq $true) {
# Upstream branch is gone
$branchStatusTextSpan = [PoshGitTextSpan]::new($s.BranchGoneStatusSymbol)
}
elseif (!$Status.Upstream) {
# Untracked branch
$branchStatusTextSpan = [PoshGitTextSpan]::new($s.BranchUntrackedStatusSymbol)
}

$branchStatusTextSpan.Text = ''
$branchStatusTextSpan
Expand Down Expand Up @@ -457,7 +465,8 @@ function Write-GitBranchStatus {
$branchStatusTextSpan = Get-GitBranchStatusColor $Status

if (!$Status.Upstream) {
$branchStatusTextSpan.Text = $s.BranchUntrackedText
# Untracked branch
$branchStatusTextSpan.Text = $s.BranchUntrackedStatusSymbol.Text
}
elseif ($Status.UpstreamGone -eq $true) {
# Upstream branch is gone
Expand Down
2 changes: 1 addition & 1 deletion src/PoshGitTypes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class PoshGitPromptSettings {
[PoshGitTextSpan]$LocalWorkingStatusSymbol = [PoshGitTextSpan]::new('!', [ConsoleColor]::DarkRed)
[PoshGitTextSpan]$LocalStagedStatusSymbol = [PoshGitTextSpan]::new('~', [ConsoleColor]::Cyan)

[PoshGitTextSpan]$BranchUntrackedStatusSymbol = [PoshGitTextSpan]::new('', [ConsoleColor]::DarkCyan) #
[PoshGitTextSpan]$BranchGoneStatusSymbol = [PoshGitTextSpan]::new([char]0x00D7, [ConsoleColor]::DarkCyan) # × Multiplication sign
[PoshGitTextSpan]$BranchIdenticalStatusSymbol = [PoshGitTextSpan]::new([char]0x2261, [ConsoleColor]::Cyan) # ≡ Three horizontal lines
[PoshGitTextSpan]$BranchAheadStatusSymbol = [PoshGitTextSpan]::new([char]0x2191, [ConsoleColor]::Green) # ↑ Up arrow
Expand All @@ -262,7 +263,6 @@ class PoshGitPromptSettings {
[string]$FileModifiedText = '~'
[string]$FileRemovedText = '-'
[string]$FileConflictedText = '!'
[string]$BranchUntrackedText = ''

[bool]$EnableStashStatus = $false
[bool]$ShowStatusWhenZero = $true
Expand Down