mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-31 18:09:19 +01:00
Update fetch-repo.ps1
This commit is contained in:
parent
4ef2f3e384
commit
2c026ee81e
@ -10,7 +10,7 @@
|
|||||||
⏳ (1/3) Searching for Git executable... git version 2.38.1.windows.1
|
⏳ (1/3) Searching for Git executable... git version 2.38.1.windows.1
|
||||||
⏳ (2/3) Checking Git repository 📂PowerShell...
|
⏳ (2/3) Checking Git repository 📂PowerShell...
|
||||||
⏳ (3/3) Fetching updates (including submodules)...
|
⏳ (3/3) Fetching updates (including submodules)...
|
||||||
✔️ fetched updates for Git repository 📂PowerShell in 2 sec.
|
✔️ fetched updates for 📂PowerShell repository in 2 sec.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -27,15 +27,15 @@ try {
|
|||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
$RepoDirName = (Get-Item "$RepoDir").Name
|
$RepoDirName = (Get-Item "$RepoDir").Name
|
||||||
"⏳ (2/3) Checking Git repository 📂$RepoDirName... "
|
Write-Host "⏳ (2/3) Checking Git repository... 📂$RepoDirName"
|
||||||
if (!(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
|
if (!(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
|
||||||
|
|
||||||
"⏳ (3/3) Fetching updates (including submodules)... "
|
Write-Host "⏳ (3/3) Fetching updates... "
|
||||||
& git -C "$RepoDir" fetch --all --recurse-submodules --prune --prune-tags --force
|
& git -C "$RepoDir" fetch --all --recurse-submodules --prune --prune-tags --force
|
||||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ fetched updates for Git repository 📂$RepoDirName in $Elapsed sec."
|
"✔️ fetched updates for 📂$RepoDirName repository in $Elapsed sec."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user