Skip to content

Add the Remove-PoshGitFromProfile function#877

Merged
dahlbyk merged 7 commits intodahlbyk:masterfrom
dscho:Remove-PoshGitFromProfile
Mar 31, 2022
Merged

Add the Remove-PoshGitFromProfile function#877
dahlbyk merged 7 commits intodahlbyk:masterfrom
dscho:Remove-PoshGitFromProfile

Conversation

@dscho
Copy link
Copy Markdown
Contributor

@dscho dscho commented Dec 10, 2021

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.

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>
@dscho
Copy link
Copy Markdown
Contributor Author

dscho commented Dec 10, 2021

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.

@dscho
Copy link
Copy Markdown
Contributor Author

dscho commented Jan 6, 2022

@dahlbyk ping?

@dscho
Copy link
Copy Markdown
Contributor Author

dscho commented Jan 9, 2022

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 ;-)

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
Copy link
Copy Markdown
Owner

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:

$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.

@dahlbyk dahlbyk merged commit 7764b4f into dahlbyk:master Mar 31, 2022
@dscho dscho deleted the Remove-PoshGitFromProfile branch March 31, 2022 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants