Always fixup clone win_git repo owner

This commit is contained in:
2023-07-29 12:07:05 +01:00
parent 3b312e6f9a
commit 58cd98c817
3 changed files with 9 additions and 16 deletions

View File

@@ -127,14 +127,6 @@ function Invoke-GitClone {
if ($result.rc -ne 0) {
$module.FailJson($result.stderr)
}
# Ensure the newly cloned repository has the correct owner
$userName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$idRef = [System.Security.Principal.NTAccount]::new($userName)
Get-Item $dest | foreach { `
$_ ; $_ | Get-ChildItem -Force -Recurse `
} | foreach { `
$acl = $_ | Get-Acl; $acl.SetOwner($idRef); $_ | Set-Acl -AclObject $acl `
}
}
function Invoke-GitCheckout {
@@ -228,4 +220,13 @@ if ($recursive) {
Invoke-GitSubmoduleUpdate $dest
}
# Ensure the repository has the correct owner
$userName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$idRef = [System.Security.Principal.NTAccount]::new($userName)
Get-Item $dest | foreach { `
$_ ; $_ | Get-ChildItem -Force -Recurse `
} | foreach { `
$acl = $_ | Get-Acl; $acl.SetOwner($idRef); $_ | Set-Acl -AclObject $acl `
}
$module.ExitJson()