modified: RdzeN-Profile.ps1
This commit is contained in:
parent
33e7c6f5c3
commit
222371c55d
@ -51,9 +51,14 @@ if (-not (Test-Path $path_profile_file)) {
|
||||
} else {
|
||||
# Check if the profile file has been modified
|
||||
$local_profile_hash = Get-FileHash -Path $path_profile_file -Algorithm SHA1
|
||||
$remote_profile_hash = git hash-object $path_profile_file
|
||||
|
||||
if ($local_profile_hash.Hash -ne $remote_profile_hash.Trim()) {
|
||||
# Dodaj nagłówek do lokalnego hasha
|
||||
$local_profile_hash_with_header = "blob $($local_profile_hash.Length)`0" + (Get-Content $path_profile_file -Raw)
|
||||
$local_profile_hash_with_header = Get-FileHash -Algorithm SHA1 -InputStream ([System.IO.MemoryStream]::new([System.Text.Encoding]::UTF8.GetBytes($local_profile_hash_with_header)))
|
||||
|
||||
$remote_profile_hash = & git hash-object $path_profile_file
|
||||
|
||||
if ($local_profile_hash_with_header.Hash.ToLower() -ne $remote_profile_hash.Trim()) {
|
||||
Write-Host "Local profile file has been modified. Pulling from repository..." -ForegroundColor Yellow
|
||||
Pull-Repository
|
||||
Get-ChildItem $path_gitea_powershell_profile_functions | ForEach-Object {
|
||||
|
Loading…
x
Reference in New Issue
Block a user