Files

25 lines
676 B
PowerShell

$ErrorActionPreference = "Stop"
$expectedRoot = "D:\qipai"
$current = (Resolve-Path ".").Path
if ($current -ne $expectedRoot) {
throw "Workspace must be $expectedRoot, actual: $current"
}
$gitRoot = (& git rev-parse --show-toplevel) -replace '/', '\'
if ($gitRoot -ne $expectedRoot) {
throw "Git root must be $expectedRoot, actual: $gitRoot"
}
$branch = & git branch --show-current
if ($branch -ne "main") {
throw "Branch must be main, actual: $branch"
}
$origin = & git remote get-url origin
if ($origin -ne "ssh://git@git.txyundm.cn:2222/panda/qipai.git") {
throw "Invalid origin: $origin"
}
Write-Host "PASS: workspace, git root, branch and origin are valid."