mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 09:53:57 +01:00
Update the scripts
This commit is contained in:
parent
153bdabaec
commit
8d6f38ff40
@ -1,7 +1,7 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./clean-branch.ps1 [<repo-dir>]
|
||||
.DESCRIPTION cleans the current Git branch including submodules from generated files (e.g. for a fresh build)
|
||||
.DESCRIPTION cleans the current/given Git repository from generated files (including submodules, e.g. for a fresh build)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
@ -16,8 +16,10 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
write-progress "Cleaning current branch in repository $RepoDir..."
|
||||
set-location $RepoDir
|
||||
write-progress "Cleaning Git repository $RepoDir from generated files ..."
|
||||
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
& git clean -fdx # force + recurse into dirs + don't use the standard ignore rules
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' failed" }
|
||||
@ -25,7 +27,7 @@ try {
|
||||
& git submodule foreach --recursive git clean -fdx
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
|
||||
|
||||
write-host -foregroundColor green "OK - cleaned current branch in repository $RepoDir"
|
||||
write-host -foregroundColor green "OK - cleaned Git repository $RepoDir from generated files"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -9,9 +9,9 @@
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
write-output "Fetching updates in Git repository $RepoDir ..."
|
||||
write-output "Fetching updates for Git repository $RepoDir ..."
|
||||
|
||||
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository at: $RepoDir" }
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
& git --version
|
||||
|
@ -16,8 +16,11 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
write-progress "Fetching Git repositories under $ParentDir ..."
|
||||
write-progress "Fetching updates for Git repositories under $ParentDir ..."
|
||||
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
set-location $ParentDir
|
||||
|
||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||
set-location $_.FullName
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
param($RepoDir = "$PWD", $Pattern = "*")
|
||||
|
||||
try {
|
||||
write-output "Fetching updates in Git repository $RepoDir ..."
|
||||
write-output "Fetching updates for Git repository $RepoDir ..."
|
||||
|
||||
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository directory: $RepoDir" }
|
||||
set-location $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" }
|
||||
|
@ -9,10 +9,10 @@
|
||||
param($RepoDir = "$PWD", $Format = "compact")
|
||||
|
||||
try {
|
||||
write-output "Fetching updates in Git repository $RepoDir ..."
|
||||
write-output "Fetching updates for Git repository $RepoDir ..."
|
||||
|
||||
if (-not(test-path "$RepoDir")) { throw "Can't access Git repository directory: $RepoDir" }
|
||||
set-location $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" }
|
||||
|
@ -20,7 +20,8 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
set-location $RepoDir
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
& git switch --recurse-submodules $Branch
|
||||
if ($lastExitCode -ne "0") { throw "'git switch --recurse-submodules $Branch' failed" }
|
||||
|
Loading…
Reference in New Issue
Block a user