Update move-with-hist.ps1

This commit is contained in:
aybe
2020-10-10 22:47:41 +02:00
parent 2c2ce56c2a
commit 719f77a47f

View File

@@ -40,13 +40,30 @@ $gitdir = $gitdir.Trim()
$dirlen = $gitdir.Split("/").Count $dirlen = $gitdir.Split("/").Count
foreach ($patch in $patchs) foreach ($patch in $patchs)
{ {
<# not working
$diff = & git config diff.noprefix
& git config diff.noprefix true
#>
& git apply --directory=$gitdir -p $dirlen "$patch" & git apply --directory=$gitdir -p $dirlen "$patch"
<# not working
if ([string]::IsNullOrWhiteSpace($diff))
{
& git config --unset diff.noprefix
}
else
{
& git config diff.noprefix $diff
}
#>
$hash = (Get-Content $patch)[0].Substring(5, 40) $hash = (Get-Content $patch)[0].Substring(5, 40)
$mail = (Get-Content $patch)[1].Substring(6) $mail = (Get-Content $patch)[1].Substring(6)
$date = (Get-Content $patch)[2].Substring(6) $date = (Get-Content $patch)[2].Substring(6)
$text = (Get-Content $patch)[3].Substring(9) $text = (Get-Content $patch)[3].Substring(9)
$data = "NOTE: auto-magically re-imported by HAL 9000`r`nHASH: {0} (original)" -f $hash $data = "NOTE: auto-magically re-imported by HAL 9000`r`nHASH: {0} (original)" -f $hash
$text = "[MIGRATED] {0}" -f $text
& git add $target & git add $target
& git commit -m "$text" -m "$data" --date="$date" --author="$mail" & git commit -m "$text" -m "$data" --date="$date" --author="$mail"
@@ -56,6 +73,6 @@ foreach ($patch in $patchs)
Write-Host("Removing original file {0}" -f $source) -ForegroundColor Yellow Write-Host("Removing original file {0}" -f $source) -ForegroundColor Yellow
& git rm $source & git rm $source
& git commit -m $("Deleted {0}" -f $source) $source & git commit -m $("[MIGRATED] Delete {0}" -f $source) -m "NOTE: file deleted after being migrated with original history" $source
Write-Host("Complete") -ForegroundColor Green Write-Host("Complete") -ForegroundColor Green