aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-03-03 11:12:13 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-03-03 11:12:13 -0500
commitea008d206c5caa28dc53abb7d674b42e2deedee5 (patch)
treefaf1611a4d2499c16a996f6929dbe951bb2ad991
parent8c9a70554265b91e8adf9afcf20390ab0c0f1729 (diff)
downloadb4-ea008d206c5caa28dc53abb7d674b42e2deedee5.tar.gz
ez: refuse to cleanup currently checked-out branch
We can't cleanly delete the branch that is currently checked out, so refuse to do it. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ez.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/b4/ez.py b/b4/ez.py
index ce16916..5f7f1c9 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1781,7 +1781,12 @@ def cleanup(param: str) -> None:
base_commit, start_commit, end_commit, oneline, shortlog, diffstat = get_series_details(usebranch=mybranch)
# start commit and end commit can't be the same
if start_commit == end_commit:
- logger.critical('%s appears to be an empty branch', mybranch)
+ logger.critical('CRITICAL: %s appears to be an empty branch', mybranch)
+ sys.exit(1)
+ # Refuse to clean up the currently checked out branch
+ curbranch = b4.git_get_current_branch()
+ if curbranch == mybranch:
+ logger.critical('CRITICAL: %s is currently checked out, cannot cleanup', mybranch)
sys.exit(1)
cover, tracking = load_cover(usebranch=mybranch)
# Find all tags