Permalink
Browse files

Avoid polluting $error on module load

Closes #116
  • Loading branch information...
1 parent c282807 commit 02a3d8809f4b379e3a68d667248e620dbdb0c98a @lzybkr lzybkr committed with Sep 30, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 GitPrompt.ps1
  2. +2 −2 GitTabExpansion.ps1
View
@@ -144,7 +144,7 @@ function Write-GitStatus($status) {
}
}
-if((Get-Variable -Scope Global -Name VcsPromptStatuses -ErrorAction SilentlyContinue) -eq $null) {
+if(!(Test-Path Variable:Global:VcsPromptStatuses)) {
$Global:VcsPromptStatuses = @()
}
function Global:Write-VcsStatus { $Global:VcsPromptStatuses | foreach { & $_ } }
View
@@ -31,7 +31,7 @@ function script:gitCmdOperations($commands, $command, $filter) {
$script:someCommands = @('add','am','annotate','archive','bisect','blame','branch','bundle','checkout','cherry','cherry-pick','citool','clean','clone','commit','config','describe','diff','difftool','fetch','format-patch','gc','grep','gui','help','init','instaweb','log','merge','mergetool','mv','notes','prune','pull','push','rebase','reflog','remote','rerere','reset','revert','rm','shortlog','show','stash','status','submodule','svn','tag','whatchanged')
try {
- if ((git flow 2> $null) -ne $null) {
+ if ((git help -a 2>&1 | Select-String flow) -ne $null) {
$script:someCommands += 'flow'
}
}
@@ -280,7 +280,7 @@ function GitTabExpansion($lastBlock) {
}
}
-$PowerTab_RegisterTabExpansion = Get-Command Register-TabExpansion -Module powertab -ErrorAction SilentlyContinue
+$PowerTab_RegisterTabExpansion = if (Get-Module -Name powertab) { Get-Command Register-TabExpansion -Module powertab -ErrorAction SilentlyContinue }
if ($PowerTab_RegisterTabExpansion)
{
& $PowerTab_RegisterTabExpansion "git.exe" -Type Command {

0 comments on commit 02a3d88

Please sign in to comment.