Skip to content

Commit

Permalink
Merge pull request #560 from jkloetzke/fix-git-switch
Browse files Browse the repository at this point in the history
Fix git branch switch
  • Loading branch information
jkloetzke authored Mar 27, 2024
2 parents b28daf1 + 7fc7919 commit cda3539
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pym/bob/scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ async def __checkoutBranch(self, invoker, fetchCmd, switch):
# We're switching the ref. There we will actively change the branch which
# is normally forbidden.
if await invoker.callCommand(["git", "show-ref", "-q", "--verify",
"refs/heads/" + self.__branch]):
"refs/heads/" + self.__branch],
cwd=self.__dir):
# Branch does not exist. Create and checkout.
await invoker.checkCommand(["git", "checkout", "--no-recurse-submodules",
"-b", self.__branch, "remotes/origin/"+self.__branch], cwd=self.__dir)
Expand All @@ -382,8 +383,7 @@ async def __checkoutBranch(self, invoker, fetchCmd, switch):
await invoker.checkCommand(["git", "checkout", "--no-recurse-submodules",
self.__branch], cwd=self.__dir)
preUpdate = await self.__updateSubmodulesPre(invoker)
await invoker.checkCommand(["git", "-c", "submodule.recurse=0", "merge",
"--ff-only", "refs/remotes/origin/"+self.__branch], cwd=self.__dir)
await self.__forwardBranch(invoker, oldUpstreamCommit)
await self.__updateSubmodulesPost(invoker, preUpdate)
elif (await invoker.checkOutputCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=self.__dir)) == self.__branch:
# pull only if on original branch
Expand Down

0 comments on commit cda3539

Please sign in to comment.