Update list-branches.ps1 and list-commits.ps1

This commit is contained in:
Markus Fleschutz 2021-03-15 13:02:58 +01:00
parent c1376ed2bb
commit 3485a5c4b8
2 changed files with 10 additions and 8 deletions

View File

@ -9,17 +9,18 @@
param($RepoDir = "$PWD", $Pattern = "*")
try {
write-output "Listing Git branches in repository $RepoDir ..."
write-progress "Fetching changes in repository $RepoDir ..."
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository at: $RepoDir" }
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository directory: $RepoDir" }
set-location $RepoDir
$null = (git --version)
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$null = (git fetch --all --recurse-submodules)
& git fetch --all --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" }
write-output "List of Git branches in repository $($RepoDir):"
$Branches = $(git branch --list --remotes --no-color --no-column)
if ($lastExitCode -ne "0") { throw "'git branch --list' failed" }

View File

@ -9,17 +9,18 @@
param($RepoDir = "$PWD", $Format = "compact")
try {
write-output "Listing commits of Git repository $RepoDir ..."
write-progress "Fetching changes in Git repository $RepoDir ..."
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository at: $RepoDir" }
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository directory: $RepoDir" }
set-location $RepoDir
$null = (git --version)
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$null = (git fetch --all --recurse-submodules)
& git fetch --all --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" }
write-output "List of commits in Git repository $($RepoDir):"
if ($Format -eq "compact") {
& git log --graph --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %C(bold blue)by %an %cr%Creset' --abbrev-commit
} else {