Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add version check to install and module. Closes #7

  • Loading branch information...
commit 6cea2f4e15001e70b29d3d8dec12da6e5a7f7d40 1 parent 9b41b27
@dahlbyk authored
Showing with 14 additions and 1 deletion.
  1. +7 −0 CheckVersion.ps1
  2. +5 −1 install.ps1
  3. +2 −0  posh-git.psm1
View
7 CheckVersion.ps1
@@ -0,0 +1,7 @@
+$version = git --version 2> $null
+if($version -notlike 'git version 1.7.*.msysgit.*') {
+ Write-Warning "posh-git requires msysgit version 1.7. You have $version."
+ $false
+} else {
+ $true
+}
View
6 install.ps1
@@ -10,6 +10,11 @@ if(!(Get-Command git -ErrorAction SilentlyContinue)) {
return
}
+$installDir = Split-Path $MyInvocation.MyCommand.Path -Parent
+if(!($installDir\CheckVersion.ps1)) {
+ return
+}
+
if(!(Test-Path $PROFILE)) {
Write-Host "Creating PowerShell profile...`n$PROFILE"
New-Item $PROFILE -Force -Type File -ErrorAction Stop -WhatIf:$WhatIf > $null
@@ -31,7 +36,6 @@ function Get-FileEncoding($Path) {
}
}
-$installDir = Split-Path $MyInvocation.MyCommand.Path -Parent
$profileLine = ". $installDir\profile.example.ps1"
if(Select-String -Path $PROFILE -Pattern $profileLine -Quiet -SimpleMatch) {
Write-Host "It seems posh-git is already installed..."
View
2  posh-git.psm1
@@ -1,4 +1,6 @@
Push-Location $psScriptRoot
+.\CheckVersion.ps1 > $null
+
. ./Utils.ps1
. ./GitUtils.ps1
. ./GitPrompt.ps1
Please sign in to comment.
Something went wrong with that request. Please try again.