mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 09:04:18 +01:00
Update check-repo.ps1
This commit is contained in:
parent
45f96fa3a2
commit
444331ebc2
@ -18,30 +18,39 @@ param([string]$RepoDir = "$PWD")
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
Write-Host "⏳ (1/6) Searching for Git... " -noNewline
|
||||
Write-Host "⏳ (1/8) Searching for Git executable... " -noNewline
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
Write-Host "⏳ (2/8) Checking path... " -noNewline
|
||||
$FullPath = Resolve-Path "$RepoDir"
|
||||
Write-Host "⏳ (2/6) Checking path... " -noNewline
|
||||
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
|
||||
"$FullPath"
|
||||
|
||||
Write-Host "⏳ (3/6) Searching for subfolder 📂.git..." -noNewline
|
||||
Write-Host "⏳ (3/8) Searching for 📂.git... " -noNewline
|
||||
if (!(Test-Path "$FullPath/.git" -pathType container)) { throw "Can't access folder: $FullPath/.git" }
|
||||
"OK"
|
||||
|
||||
Write-Host "⏳ (4/6) Querying remote URL... " -noNewline
|
||||
Write-Host "⏳ (4/8) Query remote URL... " -noNewline
|
||||
& git -C "$FullPath" remote get-url origin
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed with exit code $lastExitCode" }
|
||||
if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
|
||||
|
||||
Write-Host "⏳ (5/6) Verifying data integrity..."
|
||||
Write-Host "⏳ (5/8) Query current branch... " -noNewline
|
||||
& git -C "$FullPath" branch --show-current
|
||||
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
|
||||
|
||||
Write-Host "⏳ (6/8) Verifying data integrity..."
|
||||
& git -C "$FullPath" fsck
|
||||
if ($lastExitCode -ne "0") { throw "'git fsck' failed with exit code $lastExitCode" }
|
||||
|
||||
Write-Host "⏳ (6/6) Checking status... " -noNewline
|
||||
Write-Host "⏳ (7/8) Query submodule status... " -noNewline
|
||||
& git -C "$FullPath" submodule status
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule status' failed with exit code $lastExitCode" }
|
||||
" "
|
||||
|
||||
Write-Host "⏳ (8/8) Query repo status... " -noNewline
|
||||
& git -C "$FullPath" status --short
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed with exit code $lastExitCode" }
|
||||
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
|
||||
" "
|
||||
|
||||
$RepoDirName = (Get-Item "$FullPath").Name
|
||||
|
Loading…
Reference in New Issue
Block a user