diff --git a/Scripts/create-branch.ps1 b/Scripts/create-branch.ps1 index 61237b85..2a736f66 100755 --- a/Scripts/create-branch.ps1 +++ b/Scripts/create-branch.ps1 @@ -23,8 +23,8 @@ try { if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" } if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" } - & git fetch --all --recurse-submodules --jobs=4 - if ($lastExitCode -ne "0") { throw "'git fetch' failed" } + & "$PSScriptRoot/fetch-repo.ps1" + if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" } & git checkout -b "$NewBranchName" if ($lastExitCode -ne "0") { throw "'git checkout -b $NewBranchName' failed" } diff --git a/Scripts/create-tag.ps1 b/Scripts/create-tag.ps1 index 02c5dd2b..3e3b4129 100755 --- a/Scripts/create-tag.ps1 +++ b/Scripts/create-tag.ps1 @@ -23,8 +23,8 @@ try { if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" } if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" } - & git fetch --all --recurse-submodules --jobs=4 - if ($lastExitCode -ne "0") { throw "'git fetch' failed" } + & "$PSScriptRoot/fetch-repo.ps1" + if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" } & git tag "$NewTagName" if ($lastExitCode -ne "0") { throw "Error: 'git tag $NewTagName' failed!" } diff --git a/Scripts/fetch-repo.ps1 b/Scripts/fetch-repo.ps1 index 8c2e6dd9..83babda3 100755 --- a/Scripts/fetch-repo.ps1 +++ b/Scripts/fetch-repo.ps1 @@ -14,17 +14,12 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & 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 if ($lastExitCode -ne "0") { # retry once: start-sleep -milliseconds 1000 & git fetch --all --recurse-submodules --jobs=1 if ($lastExitCode -ne "0") { throw "'git fetch' failed" } } - - write-host -foregroundColor green "OK - fetched updates for Git repository $RepoDir" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/list-branches.ps1 b/Scripts/list-branches.ps1 index 621f2e19..fdf38c58 100755 --- a/Scripts/list-branches.ps1 +++ b/Scripts/list-branches.ps1 @@ -9,16 +9,14 @@ param($RepoDir = "$PWD", $Pattern = "*") try { - write-output "Fetching updates for Git repository $RepoDir ..." - if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" & 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 - if ($lastExitCode -ne "0") { throw "'git fetch' failed" } + & "$PSScriptRoot/fetch-repo.ps1" + if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" } write-output "" write-output "List of Git Branches" diff --git a/Scripts/list-commits.ps1 b/Scripts/list-commits.ps1 index b6fb4fd0..1f229492 100755 --- a/Scripts/list-commits.ps1 +++ b/Scripts/list-commits.ps1 @@ -9,16 +9,14 @@ param($RepoDir = "$PWD", $Format = "compact") try { - write-output "Fetching updates for Git repository $RepoDir ..." - if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" & 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 - if ($lastExitCode -ne "0") { throw "'git fetch' failed" } + & "$PSScriptRoot/fetch-repo.ps1" + if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" } write-output "" write-output "List of Git Commits" diff --git a/Scripts/list-tags.ps1 b/Scripts/list-tags.ps1 index fb261766..69728382 100755 --- a/Scripts/list-tags.ps1 +++ b/Scripts/list-tags.ps1 @@ -17,8 +17,8 @@ try { & git --version if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } - & git fetch --all --recurse-submodules - if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" } + & "$PSScriptRoot/fetch-repo.ps1" + if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" } write-output "" write-output "List of Git Tags" diff --git a/Scripts/switch-branch.ps1 b/Scripts/switch-branch.ps1 index 34637f83..2a513271 100755 --- a/Scripts/switch-branch.ps1 +++ b/Scripts/switch-branch.ps1 @@ -23,8 +23,8 @@ try { if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" } if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" } - & git fetch --all --recurse-submodules --jobs=4 - if ($lastExitCode -ne "0") { throw "'git fetch' failed" } + & "$PSScriptRoot/fetch-repo.ps1" + if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" } & git switch --recurse-submodules "$BranchName" if ($lastExitCode -ne "0") { throw "'git switch $BranchName' failed" }