diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-03-03 11:12:13 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-03-03 11:12:13 -0500 |
commit | ea008d206c5caa28dc53abb7d674b42e2deedee5 (patch) | |
tree | faf1611a4d2499c16a996f6929dbe951bb2ad991 | |
parent | 8c9a70554265b91e8adf9afcf20390ab0c0f1729 (diff) | |
download | b4-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.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |