8000 Adjust gitPython pull call to handle detached head situation. · Christian06810/python-sasctl@d68471a · GitHub
[go: up one dir, main page]

Skip to content

Commit d68471a

Browse files
committed
Adjust gitPython pull call to handle detached head situation.
1 parent c1f09f4 commit d68471a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/sasctl/pzmm/gitIntegration.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from uuid import UUID
66
from warnings import warn
77
import zipfile
8+
import git
89
from git import Repo
910
import io
1011

@@ -284,20 +285,21 @@ def gitRepoPush(cls, gPath, commitMessage, branch="origin"):
284285
pushBranch.push()
285286

286287
@classmethod
287-
def gitRepoPull(cls, gPath, branch="origin"):
288+
def gitRepoPull(cls, gPath, remote="origin", branch="main"):
288289
"""Pull down any changes from a remote branch of the git repository. The default branch is
289290
origin.
290291
291292
Parameters
292293
----------
293294
gPath : string or Path
294295
Base directory of the git repository.
296+
remote : string
297+
Remote name for the remote repository, by default 'origin'
295298
branch : string
296-
Branch name for the remote repository, by default 'origin'
299+
Branch name for the target pull branch from remote, by default 'main'
297300
"""
298-
repo = Repo(gPath)
299-
pullBranch = repo.remote(name=branch)
300-
pullBranch.pull()
301+
repo = git.Git(gPath)
302+
repo.pull(remote, branch)
301303

302304
@classmethod
303305
def pushGitProject(cls, gPath, project=None):

0 commit comments

Comments
 (0)
0