From 175e6ece0d4252a9ab385d1a3afd8825e2435aa9 Mon Sep 17 00:00:00 2001 From: Vadim Trochinsky Date: Wed, 3 Sep 2025 19:12:54 +0200 Subject: [PATCH 1/3] refs #2703: fix function name/return mismatch --- ogclient/lib/python3/GitLib/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ogclient/lib/python3/GitLib/__init__.py b/ogclient/lib/python3/GitLib/__init__.py index ee78d2a..5836578 100755 --- a/ogclient/lib/python3/GitLib/__init__.py +++ b/ogclient/lib/python3/GitLib/__init__.py @@ -1742,21 +1742,21 @@ class OpengnsysGitLibrary: meta_dir = os.path.join(path, ".opengnsys-metadata") if not os.path.exists(meta_dir): self.logger.error("Metadata directory is missing") - return False + return True restore_meta_lock = os.path.join(meta_dir, "restore_metadata.lock") create_meta_lock = os.path.join(meta_dir, "restore_metadata.lock") if os.path.exists(restore_meta_lock): self.logger.error("Metadata restoration didn't finish") - return False + return True if os.path.exists(create_meta_lock): self.logger.error("Metadata creation didn't finish") - return False + return True self.logger.info("Check ok") - return True + return False -- 2.40.1 From a10d1b10cba710d061c11bea8ffa4848221e5206 Mon Sep 17 00:00:00 2001 From: Vadim Trochinsky Date: Fri, 5 Sep 2025 09:28:12 +0200 Subject: [PATCH 2/3] refs #2506 don't create branch if we're already on it --- ogclient/interfaceAdm/ModificarImagenGit | 7 +++++-- ogclient/lib/python3/GitLib/__init__.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ogclient/interfaceAdm/ModificarImagenGit b/ogclient/interfaceAdm/ModificarImagenGit index ab5861c..805e251 100755 --- a/ogclient/interfaceAdm/ModificarImagenGit +++ b/ogclient/interfaceAdm/ModificarImagenGit @@ -86,8 +86,11 @@ def commit_image(disk_num, partition_num, repository, branch, options, msg): try: if branch: - if not og_git.create_branch(device = device, name = branch): - sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, f"Failed to create branch")) + if og_git.get_current_branch(device = device) == branch: + SystemLib.ogEcho(["command"], "info", "Branch same as active branch, not creating one.") + else: + if not og_git.create_branch(device = device, name = branch): + sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, f"Failed to create branch")) og_git.commit(device = device, message = msg) og_git.push(device = device, force = force_push) diff --git a/ogclient/lib/python3/GitLib/__init__.py b/ogclient/lib/python3/GitLib/__init__.py index 5836578..082c6d5 100755 --- a/ogclient/lib/python3/GitLib/__init__.py +++ b/ogclient/lib/python3/GitLib/__init__.py @@ -1626,6 +1626,23 @@ class OpengnsysGitLibrary: # Restaurar cosas modificadas para git self._restore_metadata(path, destructive_only=True) + def get_current_branch(self, path = None, device = None): + """Returns the current active branch + + Args: + path (string, optional): Mountpoint + device (string, optional): Device. Either mountpoint or device must be provided. + + Returns: + string: Branch name + """ + if path is None: + path = self.fs.ensure_mounted(device) + + repo = git.Repo(path) + return repo.active_branch.name + + def create_branch(self, path = None, device = None, name = ""): if path is None: path = self.fs.ensure_mounted(device) -- 2.40.1 From 0b148d486446b673fe30c710750a8bad45fe3edc Mon Sep 17 00:00:00 2001 From: Vadim Trochinsky Date: Fri, 5 Sep 2025 09:35:00 +0200 Subject: [PATCH 3/3] refs #2506 update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a3ec99..9d45f5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.1] - 2025-09-05 + +## Change + +- Oggit branch creation fixes +- Oggit checked out repo integrity checking ## [1.4.0] - 2025-08-28 -- 2.40.1