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