mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Convert symlinks to hardlinks on windows
This commit is contained in:
1 parent
986b8b2e8f
commit
afa6850499
6 files changed
+29
No files matched your search
@@ -19,6 +19,7 @@ jobs:
|
||||
architecture: 'x64'
|
||||
|
||||
- script: |
|
||||
powershell.exe scripts/symlinks-to-hardlinks.ps1
|
||||
"C:\Program Files\Git\mingw64\bin\curl.exe" -sSf -o rustup-init.exe https://win.rustup.rs/
|
||||
.\rustup-init.exe -y
|
||||
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env powershell
|
||||
git ls-files -s | Select-String '^120000' | ConvertFrom-String -PropertyNames Get-Content,Hash,_,Path | ForEach-Object {
|
||||
$symlink = $_.Path
|
||||
|
||||
git checkout --quiet -- $symlink
|
||||
if (Test-Path $symlink -PathType Leaf) {
|
||||
$parent = (Get-Item $symlink).Directory
|
||||
} else {
|
||||
$parent = (Get-Item $symlink).Parent
|
||||
}
|
||||
$child = (Get-Content $symlink)
|
||||
|
||||
$src = (Join-Path -Path $parent -ChildPath $child)
|
||||
|
||||
if (Test-Path $src -PathType Leaf) {
|
||||
Remove-Item $symlink
|
||||
New-Item -ItemType HardLink -Name $symlink -Value $src
|
||||
} elseif (Test-Path $src -PathType Container) {
|
||||
Remove-Item $symlink
|
||||
New-Item -ItemType Junction -Name $symlink -Value $src
|
||||
} else {
|
||||
Write-Error 'error: git-rm-symlink: Not a valid source\n'
|
||||
Write-Error '$symlink =/=> $src...'
|
||||
return
|
||||
}
|
||||
|
||||
git update-index --assume-unchanged $symlink
|
||||
}
|
||||
Reference in new issue
Block a user