Skip to content

Commit

Permalink
SignatureType enum is not available on PS v2
Browse files Browse the repository at this point in the history
We now rely on the SignerCertificate field to be $null.  If it isn't $null, then we assume the profile is signed and we don't modify it.  Note that this field is not $null when the file is signed but there is a hash mismatch (which is the desired behavior). Fix #448.
  • Loading branch information
rkeithhill committed Mar 2, 2017
1 parent c2a92dd commit 588e293
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
([PR #444](https://github.com/dahlbyk/posh-git/pull/444))
- Quote tab completion for remote names containing special characters
([PR #446](https://github.com/dahlbyk/posh-git/pull/446))
- Install throws an exception due to missing SignatureType on PowerShell v2
([PR #450](https://github.com/dahlbyk/posh-git/pull/450))

## 0.7.0 - February 14, 2017
This release has focused on improving the "getting started" experience by adding an `Add-PoshGitToProfile` command that
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function Add-PoshGitToProfile {
# If the profile script exists and is signed, then we should not modify it
if (Test-Path -LiteralPath $profilePath) {
$sig = Get-AuthenticodeSignature $profilePath
if ($sig.SignatureType -eq [System.Management.Automation.SignatureType]::Authenticode) {
if ($null -ne $sig.SignerCertificate) {
Write-Warning "Skipping add of posh-git import to profile; '$profilePath' appears to be signed."
Write-Warning "Add the command 'Import-Module posh-git' to your profile and resign it."
return
Expand Down

0 comments on commit 588e293

Please sign in to comment.