diff --git a/Scripts/clone-repos.ps1 b/Scripts/clone-repos.ps1 index 26d33b6b..23bdf9bb 100755 --- a/Scripts/clone-repos.ps1 +++ b/Scripts/clone-repos.ps1 @@ -9,13 +9,9 @@ param($TargetDir = "$PWD") try { - & git --version -} catch { - write-error "ERROR: can't execute 'git' - make sure Git is installed and available" - exit 1 -} + $Null = (git --version) + if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } -try { $PathToRepo = "$PSScriptRoot/.." $Table = import-csv "$PathToRepo/Data/repos.csv" diff --git a/Scripts/configure-git.ps1 b/Scripts/configure-git.ps1 index fcff539a..6797a52e 100755 --- a/Scripts/configure-git.ps1 +++ b/Scripts/configure-git.ps1 @@ -12,13 +12,9 @@ if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail addre if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" } try { - & git --version -} catch { - write-error "Can't execute 'git' - make sure Git is installed and available" - exit 1 -} + $Null = (git --version) + if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } -try { & git config --global user.name $FullName & git config --global user.email $EmailAddress & git config --global core.editor $FavoriteEditor diff --git a/Scripts/create-branch.ps1 b/Scripts/create-branch.ps1 index 2a736f66..5e761b19 100755 --- a/Scripts/create-branch.ps1 +++ b/Scripts/create-branch.ps1 @@ -16,7 +16,7 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } $Result = (git status) diff --git a/Scripts/create-tag.ps1 b/Scripts/create-tag.ps1 index 3f5e01da..c2e84445 100755 --- a/Scripts/create-tag.ps1 +++ b/Scripts/create-tag.ps1 @@ -16,7 +16,7 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } $Result = (git status) diff --git a/Scripts/fetch-repos.ps1 b/Scripts/fetch-repos.ps1 index 8b2d99d2..e42b9e3e 100755 --- a/Scripts/fetch-repos.ps1 +++ b/Scripts/fetch-repos.ps1 @@ -14,7 +14,7 @@ try { if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" } set-location $ParentDir - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } [int]$Count = 0 diff --git a/Scripts/list-branches.ps1 b/Scripts/list-branches.ps1 index fdf38c58..ab46aae7 100755 --- a/Scripts/list-branches.ps1 +++ b/Scripts/list-branches.ps1 @@ -12,7 +12,7 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } & "$PSScriptRoot/fetch-repo.ps1" diff --git a/Scripts/list-commits.ps1 b/Scripts/list-commits.ps1 index 1f229492..cbe26f7c 100755 --- a/Scripts/list-commits.ps1 +++ b/Scripts/list-commits.ps1 @@ -12,7 +12,7 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } & "$PSScriptRoot/fetch-repo.ps1" diff --git a/Scripts/list-tags.ps1 b/Scripts/list-tags.ps1 index 69728382..191df30a 100755 --- a/Scripts/list-tags.ps1 +++ b/Scripts/list-tags.ps1 @@ -14,7 +14,7 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } & "$PSScriptRoot/fetch-repo.ps1" diff --git a/Scripts/pull-repos.ps1 b/Scripts/pull-repos.ps1 index a3954558..751bbb08 100755 --- a/Scripts/pull-repos.ps1 +++ b/Scripts/pull-repos.ps1 @@ -14,7 +14,7 @@ try { if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" } set-location "$ParentDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } [int]$Count = 0 diff --git a/Scripts/switch-branch.ps1 b/Scripts/switch-branch.ps1 index 4bc8138c..a6965670 100755 --- a/Scripts/switch-branch.ps1 +++ b/Scripts/switch-branch.ps1 @@ -13,7 +13,7 @@ try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" - & git --version + $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } $Result = (git status)