-
-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the Remove-PoshGitFromProfile
function
#877
Conversation
This is needed to be able to install/uninstall Posh-Git via Git for Windows' installer/uninstaller. See git-for-windows/build-extra#401 for details. Signed-off-by: Johannes Schindelin <[email protected]>
Please note that the CI failures are independent of the changes introduced by this here PR. At least some of them seem to have been reported before. |
@dahlbyk ping? |
Sorry to be a bother, but if we want to offer Posh-Git as an option in Git for Windows v2.35.0, we kinda need to move a little faster ;-) |
src/Utils.ps1
Outdated
$oldProfile = @(Get-Content $profilePath) | ||
|
||
. $currentVersionPath\src\Utils.ps1 | ||
$oldProfileEncoding = Get-FileEncoding $profilePath | ||
|
||
$newProfile = @() | ||
foreach($line in $oldProfile) { | ||
if ($line -like '*PoshGitPrompt*') { continue; } | ||
if ($line -like '*Load posh-git example profile*') { continue; } | ||
|
||
if($line -like '. *posh-git*profile.example.ps1*') { | ||
continue; | ||
} | ||
if($line -like 'Import-Module *\posh-git.psd1*') { | ||
continue; | ||
} | ||
$newProfile += $line | ||
} | ||
Set-Content -path $profilePath -value $newProfile -Force -Encoding $oldProfileEncoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting this is pulled from:
posh-git/chocolatey/tools/chocolateyUninstall.ps1
Lines 7 to 25 in dc2b636
$oldProfile = @(Get-Content $PROFILE) | |
. $currentVersionPath\src\Utils.ps1 | |
$oldProfileEncoding = Get-FileEncoding $PROFILE | |
$newProfile = @() | |
foreach($line in $oldProfile) { | |
if ($line -like '*PoshGitPrompt*') { continue; } | |
if ($line -like '*Load posh-git example profile*') { continue; } | |
if($line -like '. *posh-git*profile.example.ps1*') { | |
continue; | |
} | |
if($line -like 'Import-Module *\src\posh-git.psd1*') { | |
continue; | |
} | |
$newProfile += $line | |
} | |
Set-Content -path $profile -value $newProfile -Force -Encoding $oldProfileEncoding |
Will be nice to use this function there.
This is needed to be able to install/uninstall Posh-Git via Git for Windows' installer/uninstaller.
See git-for-windows/build-extra#401 for details.