From d5e97a1d85fcfccf115c59cdf1bce91e12a57798 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz <markus.fleschutz@atcsim.de> Date: Wed, 26 Oct 2022 10:30:12 +0200 Subject: [PATCH] Update check-repo.ps1 --- Scripts/check-repo.ps1 | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Scripts/check-repo.ps1 b/Scripts/check-repo.ps1 index e8098238..9213f47e 100644 --- a/Scripts/check-repo.ps1 +++ b/Scripts/check-repo.ps1 @@ -18,41 +18,51 @@ param([string]$RepoDir = "$PWD") try { $StopWatch = [system.diagnostics.stopwatch]::startNew() - Write-Host "⏳ (1/9) Searching for Git executable... " -noNewline + Write-Host "⏳ (1/11) 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/9) Checking path... " -noNewline + Write-Host "⏳ (2/11) Checking path... " -noNewline $FullPath = Resolve-Path "$RepoDir" if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" } "$FullPath" - Write-Host "⏳ (3/9) Searching for 📂.git... " -noNewline + Write-Host "⏳ (3/11) Searching for 📂.git... " -noNewline if (!(Test-Path "$FullPath/.git" -pathType container)) { throw "Can't access folder: $FullPath/.git" } "OK" - Write-Host "⏳ (4/9) Query remote URL... " -noNewline + Write-Host "⏳ (4/11) Query remote URL... " -noNewline & git -C "$FullPath" remote get-url origin if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" } - Write-Host "⏳ (5/9) Query current branch... " -noNewline + Write-Host "⏳ (5/11) 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/9) Verify data integrity..." + Write-Host "⏳ (6/11) Trying to fetch... " -noNewline + & git -C "$FullPath" fetch + if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" } + Write-Host "OK" + + Write-Host "⏳ (7/11) Query latest tag... " -noNewline + $LatestTagCommitID = (git -C "$FullPath" rev-list --tags --max-count=1) + $LatestTagName = (git -C "$FullPath" describe --tags $LatestTagCommitID) + Write-Host "$LatestTagName (commit $LatestTagCommitID)" + + Write-Host "⏳ (8/11) Verify data integrity..." & git -C "$FullPath" fsck if ($lastExitCode -ne "0") { throw "'git fsck' failed with exit code $lastExitCode" } - Write-Host "⏳ (7/9) Run maintenance tasks..." + Write-Host "⏳ (9/11) Run maintenance tasks..." & git -C "$FullPath" maintenance run if ($lastExitCode -ne "0") { throw "'git maintenance run' failed with exit code $lastExitCode" } - Write-Host "⏳ (8/9) Query submodule status... " -noNewline + Write-Host "⏳ (10/11) Query submodule status... " -noNewline & git -C "$FullPath" submodule status if ($lastExitCode -ne "0") { throw "'git submodule status' failed with exit code $lastExitCode" } " " - Write-Host "⏳ (9/9) Query repository status... " -noNewline + Write-Host "⏳ (11/11) Query repository status... " -noNewline & git -C "$FullPath" status --short if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" } " "