From 32c8fa5d4d78c819085a49f16d3e92363a27dbfc Mon Sep 17 00:00:00 2001 From: "r.jaepel" <r.jaepel@fz-juelich.de> Date: Mon, 4 Sep 2023 13:24:48 +0200 Subject: [PATCH] Fix comparison of new checkout branch to first master commit. Instead compare to current master commit --- cadetrdm/repositories.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cadetrdm/repositories.py b/cadetrdm/repositories.py index a72ef2e..4e0f57d 100644 --- a/cadetrdm/repositories.py +++ b/cadetrdm/repositories.py @@ -115,7 +115,13 @@ class BaseRepo: :return: """ previous_branch = self.active_branch.name - if str(self.head.commit) == self.earliest_commit: + if previous_branch == "master": + return + + commit_of_current_master = str(self._git.rev_parse("master")) + commit_of_current_branch = str(self.head.commit) + if commit_of_current_branch == commit_of_current_master: + print("Removing empty branch", previous_branch) self._git.checkout("master") self._git.branch("-d", previous_branch) -- GitLab