mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Update fetch-repo.ps1
This commit is contained in:
parent
0951bbc4cb
commit
39d17bbf49
@ -19,18 +19,18 @@ try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1/2: Checking requirements... "
|
||||
& git --version
|
||||
$null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
|
||||
|
||||
"⏳ Step 2/2: Fetching updates (including submodules)... "
|
||||
"⏳ Step 2/2: Fetching updates... "
|
||||
& git -C "$RepoDir" fetch --all --recurse-submodules --prune --prune-tags --force
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
|
||||
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ fetched updates for repo 📂$RepoDirName in $Elapsed sec"
|
||||
"✔️ fetched updates for 📂$RepoDirName repo in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user