Private/Assert-BareRepo.ps1
|
<#
.SYNOPSIS Throws if the given path is not the root of a bare git repository. #> function Assert-BareRepo { [CmdletBinding()] param( [string] $Path = (Get-Location).Path ) $isBare = git -C $Path rev-parse --is-bare-repository 2>$null if ($LASTEXITCODE -ne 0) { throw "Not a git repository: $Path" } if ($isBare -ne 'true') { throw "Not a bare git repository: $Path" } } |