From 6c459361185cb7ea293ecb30488ba0c935feb401 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Wed, 7 Jun 2023 22:50:20 +0100 Subject: [PATCH] BlenderBIM fix Git error on simple merge (#3096) Running git commit after a simple merge (that hasn't required conflict resolution) is a noop, but generates an annoying message anyway. --- src/blenderbim/blenderbim/tool/ifcgit.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/tool/ifcgit.py b/src/blenderbim/blenderbim/tool/ifcgit.py index 0ac0871020..654e52f832 100644 --- a/src/blenderbim/blenderbim/tool/ifcgit.py +++ b/src/blenderbim/blenderbim/tool/ifcgit.py @@ -373,6 +373,11 @@ class IfcGit: config_writer = IfcGitRepo.repo.config_writer() config_writer.set_value(section, "cmd", "ifcmerge $BASE $LOCAL $REMOTE $MERGED") config_writer.set_value(section, "trustExitCode", True) + section = 'mergetool "ifcmerge-forward"' + if not config_reader.has_section(section): + config_writer = IfcGitRepo.repo.config_writer() + config_writer.set_value(section, "cmd", "ifcmerge $BASE $REMOTE $LOCAL $MERGED") + config_writer.set_value(section, "trustExitCode", True) @classmethod def config_info_attributes(cls, repo): @@ -415,6 +420,11 @@ class IfcGit: operator.report({"ERROR"}, "IFC Merge failed:" + message) return False + else: + if os.name == "nt": + cls.dos2unix(path_ifc) + repo.index.add(path_ifc) + repo.git.commit("--no-edit") except: operator.report({"ERROR"}, "Unknown IFC Merge failure") @@ -422,10 +432,6 @@ class IfcGit: props.display_branch = repo.active_branch.name - if os.name == "nt": - cls.dos2unix(path_ifc) - repo.index.add(path_ifc) - repo.git.commit("--no-edit") cls.load_project(path_ifc) cls.refresh_revision_list(path_ifc)