Browse files

Merge pull request #184 from ferventcoder/add-choco-pkg

Bringing over posh-git package; bump to 0.6.1
  • Loading branch information...
dahlbyk committed Mar 30, 2016
2 parents 1941da2 + 68b6d06 commit a9466dcd39f2140abab78a4351c2ab888eda0db9
Showing with 33 additions and 24 deletions.
  1. +22 −6 chocolatey/poshgit.nuspec
  2. +10 −17 chocolatey/tools/chocolateyInstall.ps1
  3. +1 −1 posh-git.psd1
@@ -3,16 +3,32 @@
<authors>Keith Dahlby, Mark Embling, Jeremy Skinner</authors>
<owners>Rob Reynolds, Keith Dahlby</owners>
<description>posh-git - A set of PowerShell scripts which provide Git/PowerShell integration.
<owners>Keith Dahlby</owners>
<description>### posh-git
A set of PowerShell scripts which provide Git/PowerShell integration
### Prompt for Git repositories
The prompt within Git repositories can show the current branch and the state of files (additions, modifications, deletions) within.
### Tab completion
Provides tab completion for common commands when using git.
E.g. `git ch&lt;tab&gt;` --&gt; `git checkout`
### Usage
See profile.example.ps1 as to how you can integrate the tab completion and/or git prompt into your own profile. Prompt formatting, among other things, can be customized using `$GitPromptSettings`, `$GitTabSettings` and `$TortoiseGitSettings`.
Note on performance: displaying file status in the git prompt for a very large repo can be prohibitively slow. Rather than turn off file status entirely, you can disable it on a repo-by-repo basis by adding individual repository paths to `$GitPromptSettings.RepositoriesInWhichToDisableFileStatus`.
<summary>PoshGit - A PowerShell environment for Git</summary>
<tags>poshgit powershell git</tags>
<tags>poshgit posh-git powershell git</tags>
<dependency id="git" />
@@ -3,11 +3,11 @@
try {
$binRoot = join-path $env:systemdrive 'tools'
$binRoot = Get-BinRoot
$oldPromptOverride = "if(Test-Path Function:\Prompt) {Rename-Item Function:\Prompt PrePoshGitPrompt -Force}"
$newPromptOverride = "function Prompt() {if(Test-Path Function:\PrePoshGitPrompt){++`$global:poshScope; New-Item function:\script:Write-host -value `"param([object] ```$object, ```$backgroundColor, ```$foregroundColor, [switch] ```$nonewline) `" -Force | Out-Null;`$private:p = PrePoshGitPrompt; if(--`$global:poshScope -eq 0) {Remove-Item function:\Write-Host -Force}}PoshGitPrompt}"
### Using an environment variable to to define the bin root until we implement YAML configuration ###
if($env:chocolatey_bin_root -ne $null){$binRoot = join-path $env:systemdrive $env:chocolatey_bin_root}
$poshgitPath = join-path $binRoot 'poshgit'
try {
@@ -20,12 +20,11 @@ try {
$poshGitInstall = if($env:poshGit -ne $null){ $env:poshGit } else {''}
#Install-ChocolateyZipPackage 'poshgit' '' $poshgitPath
Install-ChocolateyZipPackage 'poshgit' $poshGitInstall $poshgitPath
$pgitDir = [Array](Dir "$poshgitPath\*posh-git*\" | Sort-Object -Property LastWriteTime)[-1]
$pgitDir = Dir "$poshgitPath\*posh-git*\" | Sort-Object -Property LastWriteTime | Select -Last 1
if(Test-Path $PROFILE) {
$oldProfile = [string[]](Get-Content $PROFILE)
$oldProfile = @(Get-Content $PROFILE)
$newProfile = @()
#If old profile exists replace with new one and make sure prompt preservation function is on top
$pgitExample = "$pgitDir\profile.example.ps1"
@@ -36,34 +35,28 @@ try {
if($line.Trim().Length -gt 0) { $newProfile += $line }
#Save any previous Prompt logic
# Save any previous Prompt logic
Insert-Script ([REF]$newProfile) $oldPromptOverride
Set-Content -path $profile -value $newProfile -Force
#------- ADDITIONAL SETUP -------#
$subfolder = get-childitem $poshgitPath -recurse -include 'dahlbyk-posh-git-*' | select -First 1
write-debug "Found and using folder `'$subfolder`'"
#$installer = Join-Path $poshgitPath $subfolder #'dahlbyk-posh-git-60be436'
$installer = Join-Path $subfolder 'install.ps1'
& $installer
$newProfile = [string[]](Get-Content $PROFILE)
$newProfile = @(Get-Content $PROFILE)
Insert-Script ([REF]$newProfile) "Rename-Item Function:\Prompt PoshGitPrompt -Force"
#function that will run previous prompt logic and then the poshgit logic
#all output from previous prompts will be swallowed
# function that will run previous prompt logic and then the poshgit logic
# all output from previous prompts will be swallowed
Insert-Script ([REF]$newProfile) $newPromptOverride
Set-Content -path $profile -value $newProfile -Force
Write-ChocolateySuccess 'poshgit'
} catch {
try {
if($oldProfile){ Set-Content -path $PROFILE -value $oldProfile -Force }
Write-ChocolateyFailure 'poshgit' $($_.Exception.Message)
catch {}
@@ -4,7 +4,7 @@
ModuleToProcess = 'posh-git.psm1'
# Version number of this module.
ModuleVersion = ''
ModuleVersion = ''
# ID used to uniquely identify this module
GUID = '74c9fd30-734b-4c89-a8ae-7727ad21d1d5'

0 comments on commit a9466dc

Please sign in to comment.