From 222371c55d2f5d39b1f8f6bc11d01d872ed9f5a9 Mon Sep 17 00:00:00 2001 From: Tomasz Kostrzewa Date: Wed, 6 Mar 2024 13:22:28 +0100 Subject: [PATCH] modified: RdzeN-Profile.ps1 --- RdzeN-Profile.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/RdzeN-Profile.ps1 b/RdzeN-Profile.ps1 index f61a82c..e0faf80 100644 --- a/RdzeN-Profile.ps1 +++ b/RdzeN-Profile.ps1 @@ -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 {