Improve both scripts

This commit is contained in:
Markus Fleschutz 2021-07-15 12:19:29 +02:00
parent b6e2063215
commit 35255539df
2 changed files with 12 additions and 14 deletions

View File

@ -15,18 +15,17 @@ param($RepoDir = "$PWD")
try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir"
$RepoDirName = (get-item "$RepoDir").Name
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git fetch --all --recurse-submodules --jobs=4
$RepoDirName = (get-item "$RepoDir").Name
"🢃 Fetching updates for Git repository 📂$RepoDirName ..."
& git -C "$RepoDir" fetch --all --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
"✔️ fetched Git repository 📂$RepoDirName"
"✔️ fetched updates for 📂$RepoDirName"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -15,18 +15,17 @@ param($RepoDir = "$PWD")
try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir"
$RepoDirName = (get-item "$RepoDir").Name
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git fetch
$RepoDirName = (get-item "$RepoDir").Name
"🢃 Fetching updates for 📂$RepoDirName ..."
& git -C "$RepoDir" fetch
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
$Tag = (git describe --tags --abbrev=0)
$Tag = (git -C "$RepoDir" describe --tags --abbrev=0)
"🔖$Tag"
exit 0
} catch {