From 566fd443db4153e89214928706953a4b714b57cd Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Thu, 25 Jan 2024 23:30:00 +0000 Subject: [PATCH] IfcGit avoid leaving stray .git/config.lock files --- src/blenderbim/blenderbim/tool/ifcgit.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/blenderbim/blenderbim/tool/ifcgit.py b/src/blenderbim/blenderbim/tool/ifcgit.py index b27bf15dba..8438344f1b 100644 --- a/src/blenderbim/blenderbim/tool/ifcgit.py +++ b/src/blenderbim/blenderbim/tool/ifcgit.py @@ -415,24 +415,25 @@ class IfcGit: @classmethod def config_ifcmerge(cls): config_reader = IfcGitRepo.repo.config_reader() - config_writer = IfcGitRepo.repo.config_writer() section = 'mergetool "ifcmerge"' if not config_reader.has_section(section): - config_writer.set_value(section, "cmd", "ifcmerge $BASE $LOCAL $REMOTE $MERGED") - config_writer.set_value(section, "trustExitCode", True) + with IfcGitRepo.repo.config_writer() as 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.set_value(section, "cmd", "ifcmerge $BASE $REMOTE $LOCAL $MERGED") - config_writer.set_value(section, "trustExitCode", True) + with IfcGitRepo.repo.config_writer() as config_writer: + config_writer.set_value(section, "cmd", "ifcmerge $BASE $REMOTE $LOCAL $MERGED") + config_writer.set_value(section, "trustExitCode", True) @classmethod def config_push(cls, repo): """Set push.autoSetupRemote""" config_reader = repo.config_reader() - config_writer = repo.config_writer() if not config_reader.has_section("push"): - config_writer.set_value("push", "default", "current") - config_writer.set_value("push", "autoSetupRemote", True) + with repo.config_writer() as config_writer: + config_writer.set_value("push", "default", "current") + config_writer.set_value("push", "autoSetupRemote", True) @classmethod def config_info_attributes(cls, repo):