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
This commit is contained in:
Bruno Postle
2023-12-15 23:26:52 +00:00
parent 491c9203b0
commit 2f3b3011ec
+10
View File
@@ -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"""