Add the Remove-PoshGitFromProfile function#877
Merged
dahlbyk merged 7 commits intodahlbyk:masterfrom Mar 31, 2022
Merged
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 <johannes.schindelin@gmx.de>
Contributor
Author
|
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. |
Contributor
Author
|
@dahlbyk ping? |
Contributor
Author
|
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 ;-) |
dahlbyk
reviewed
Mar 31, 2022
Comment on lines
+314
to
+332
| $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 |
Owner
There was a problem hiding this comment.
Noting this is pulled from:
posh-git/chocolatey/tools/chocolateyUninstall.ps1
Lines 7 to 25 in dc2b636
Will be nice to use this function there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.