Skip to content

Commit

Permalink
Update clean-repo.ps1 and switch-branch.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Fleschutz committed Sep 9, 2022
1 parent ac4df78 commit 2f8620c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Scripts/clean-repo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ try {
"⏳ Step 2/4 - Checking folder 📂$RepoDirName..."
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" }

"⏳ Step 3/4 - Cleaning Git repository..."
"⏳ Step 3/4 - Cleaning Git repository from untracked files..."
& git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo
if ($lastExitCode -ne "0") {
"'git clean' failed with exit code $lastExitCode, retrying once..."
& git -C "$RepoDir" clean -xfd -f
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
}

"⏳ Step 4/4 - Cleaning Git submodules..."
"⏳ Step 4/4 - Cleaning Git submodules from untracked files..."
& git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }

[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ cleaned Git repo 📂$RepoDirName in $Elapsed sec"
"✔️ cleaned 📂$RepoDirName repo in $Elapsed sec"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/switch-branch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ try {

$RepoDir = Resolve-Path "$RepoDir"
$RepoDirName = (Get-Item "$RepoDir").Name
"⏳ Step 2/6 - Checking Git repository 📂$RepoDirName..."
"⏳ Step 2/6 - Checking folder 📂$RepoDirName..."
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }

$Result = (git status)
Expand Down

0 comments on commit 2f8620c

Please sign in to comment.