Skip to content

Commit

Permalink
Add warning for non-G4W on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Oct 28, 2020
1 parent 43e2bf7 commit fc03a57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/CheckRequirements.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ if (!(Get-Command git -TotalCount 1 -ErrorAction SilentlyContinue)) {
return
}

if ([string](git --version 2> $null) -match '(?<ver>\d+(?:\.\d+)+)') {
if ([string](git --version 2> $null) -match '(?<ver>\d+(?:\.\d+)+)(?<g4w>\.windows)?') {
$script:GitVersion = [System.Version]$Matches['ver']

if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
if (!$Matches['g4w']) {
$script:GitCygwin = $true

if (!$Env:POSHGIT_CYGWIN_WARNING) {
Write-Warning "posh-git recommends Git for Windows. You appear to have a different distribution."
}
}
}
}

if ($GitVersion -lt $requiredVersion) {
Expand Down
2 changes: 1 addition & 1 deletion src/PoshGitTypes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class PoshGitTextSpan {
}

class PoshGitPromptSettings {
[bool]$AnsiConsole = $Host.UI.SupportsVirtualTerminal -or ($Env:ConEmuANSI -eq "ON")
[bool]$AnsiConsole = ($Host.UI.SupportsVirtualTerminal -or ($Env:ConEmuANSI -eq "ON")) -and !$script:GitCygwin
[bool]$SetEnvColumns = $true

[PoshGitCellColor]$DefaultColor = [PoshGitCellColor]::new()
Expand Down

0 comments on commit fc03a57

Please sign in to comment.