Skip to content

Commit

Permalink
Merge branch 'master' into release-v0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Apr 20, 2018
2 parents bff1496 + db46cdb commit 162cba1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
13 changes: 10 additions & 3 deletions src/GitPrompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ $global:GitPromptSettings = [pscustomobject]@{

ShowStatusWhenZero = $true

# Valid values are "all", "no", and "normal"
UntrackedFilesMode = $null

AutoRefreshIndex = $true

# Valid values are "Full", "Compact", and "Minimal"
Expand All @@ -99,6 +102,7 @@ $global:GitPromptSettings = [pscustomobject]@{
DescribeStyle = ''

EnableWindowTitle = 'posh~git ~ '
AdminTitlePrefixText = 'Administrator: '

DefaultPromptPrefix = ''
DefaultPromptSuffix = '$(''>'' * ($nestedPromptLevel + 1)) '
Expand All @@ -116,8 +120,6 @@ $global:GitPromptSettings = [pscustomobject]@{

$isAdminProcess = Test-Administrator

$adminHeader = if ($isAdminProcess) { 'Administrator: ' } else { '' }

$WindowTitleSupported = $true
if (Get-Module NuGet) {
$WindowTitleSupported = $false
Expand Down Expand Up @@ -294,7 +296,8 @@ function Write-GitStatus($status) {
}
$repoName = Split-Path -Leaf (Split-Path $status.GitDir)
$prefix = if ($s.EnableWindowTitle -is [string]) { $s.EnableWindowTitle } else { '' }
$Host.UI.RawUI.WindowTitle = "$script:adminHeader$prefix$repoName [$($status.Branch)]"
$adminHeader = if ($script:isAdminProcess) { $s.AdminTitlePrefixText } else { '' }
$Host.UI.RawUI.WindowTitle = "$adminHeader$prefix$repoName [$($status.Branch)]"
}
} elseif ( $Global:PreviousWindowTitle ) {
$Host.UI.RawUI.WindowTitle = $Global:PreviousWindowTitle
Expand Down Expand Up @@ -332,6 +335,10 @@ $PoshGitVcsPrompt = {
if ($s) {
Write-Prompt $s.BeforeText -BackgroundColor $s.BeforeBackgroundColor -ForegroundColor $s.BeforeForegroundColor
Write-Prompt "Error: $_" -BackgroundColor $s.ErrorBackgroundColor -ForegroundColor $s.ErrorForegroundColor
if ($s.Debug) {
Write-Host
Write-Verbose "PoshGitVcsPrompt error details: $($_ | Format-List * -Force | Out-String)" -Verbose
}
Write-Prompt $s.AfterText -BackgroundColor $s.AfterBackgroundColor -ForegroundColor $s.AfterForegroundColor
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/GitTabExpansion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ function script:expandParamValues($cmd, $param, $filter) {
ForEach-Object { -join ("--", $param, "=", $_) }
}

function GitTabExpansion($lastBlock) {
$res = Invoke-Utf8ConsoleCommand { GitTabExpansionInternal $lastBlock $Global:GitStatus }
function Expand-GitCommand($Command) {
$res = Invoke-Utf8ConsoleCommand { GitTabExpansionInternal $Command $Global:GitStatus }
$res
}

Expand Down Expand Up @@ -403,7 +403,7 @@ if ($PowerTab_RegisterTabExpansion) {
$line = $Context.Line
$lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart()
$TabExpansionHasOutput.Value = $true
GitTabExpansion $lastBlock
Expand-GitCommand $lastBlock
}
return
}
Expand All @@ -417,9 +417,9 @@ function TabExpansion($line, $lastWord) {

switch -regex ($lastBlock) {
# Execute git tab completion for all git-related commands
"^$(Get-AliasPattern git) (.*)" { GitTabExpansion $lastBlock }
"^$(Get-AliasPattern tgit) (.*)" { GitTabExpansion $lastBlock }
"^$(Get-AliasPattern gitk) (.*)" { GitTabExpansion $lastBlock }
"^$(Get-AliasPattern git) (.*)" { Expand-GitCommand $lastBlock }
"^$(Get-AliasPattern tgit) (.*)" { Expand-GitCommand $lastBlock }
"^$(Get-AliasPattern gitk) (.*)" { Expand-GitCommand $lastBlock }

# Fall back on existing tab expansion
default {
Expand Down
3 changes: 2 additions & 1 deletion src/GitUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ function Get-GitStatus($gitDir = (Get-GitDirectory)) {
if ($cacheResponse.State) { $branch += "|" + $cacheResponse.State }
} else {
dbg 'Getting status' $sw
$status = Invoke-Utf8ConsoleCommand { git -c core.quotepath=false -c color.status=false status --short --branch 2>$null }
$untrackedFilesOption = if($settings.UntrackedFilesMode) { "-u$($settings.UntrackedFilesMode)" } else { "" }
$status = Invoke-Utf8ConsoleCommand { git -c core.quotepath=false -c color.status=false status $untrackedFilesOption --short --branch 2>$null }
if($settings.EnableStashStatus) {
dbg 'Getting stash count' $sw
$stashCount = $null | git stash list 2>$null | measure-object | Select-Object -expand Count
Expand Down
1 change: 1 addition & 0 deletions src/posh-git.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ FunctionsToExport = @(
'Enable-GitColors',
'Get-GitDirectory',
'TabExpansion',
'Expand-GitCommand',
'Get-AliasPattern',
'Get-SshAgent',
'Start-SshAgent',
Expand Down
1 change: 1 addition & 0 deletions src/posh-git.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ $exportModuleMemberParams = @{
'Enable-GitColors',
'Get-GitDirectory',
'TabExpansion',
'Expand-GitCommand',
'Get-AliasPattern',
'Get-SshAgent',
'Start-SshAgent',
Expand Down

0 comments on commit 162cba1

Please sign in to comment.