mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-28 07:38:38 +01:00
Update fetch-repo.ps1
This commit is contained in:
parent
8482d37c3b
commit
2e86cb0fa4
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Fetches Git repository updates
|
||||
Fetches updates for a Git repository
|
||||
.DESCRIPTION
|
||||
This PowerShell script fetches updates for a local Git repository (including submodules).
|
||||
.PARAMETER RepoDir
|
||||
@ -24,15 +24,15 @@ try {
|
||||
|
||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
|
||||
|
||||
"⏳ Step 2/2: Fetching updates... "
|
||||
"⏳ Step 2/2: Fetching updates (including submodules)... "
|
||||
& 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 Git repository 📂$RepoDirName in $Elapsed sec"
|
||||
"✔️ fetched updates for repo 📂$RepoDirName in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user