From 2f3b3011ecc807bed09301df6a87c76cee842362 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Fri, 15 Dec 2023 23:26:52 +0000 Subject: [PATCH] BlenderBIM IFC Git set push.autoSetupRemote When pushing to a remote repository set tracking for the current branch so that a locally created repository behaves the same (on the command-line) as a cloned repository --- src/blenderbim/blenderbim/tool/ifcgit.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/blenderbim/blenderbim/tool/ifcgit.py b/src/blenderbim/blenderbim/tool/ifcgit.py index e9f8640a99..82daab53b9 100644 --- a/src/blenderbim/blenderbim/tool/ifcgit.py +++ b/src/blenderbim/blenderbim/tool/ifcgit.py @@ -132,6 +132,7 @@ class IfcGit: @classmethod def push(cls, repo, remote_name, branch_name): + cls.config_push(repo) remote = repo.remotes[remote_name] try: remote.push(tags=True, refspec=branch_name).raise_if_error() @@ -423,6 +424,15 @@ class IfcGit: 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) + @classmethod def config_info_attributes(cls, repo): """Set IFC files as text in .git/info/attributes"""