#4020 Avoid hard coded ref names
Closed 5 years ago by wattersmt. Opened 5 years ago by wattersmt.
Unknown source 4017_fix_merge_bug  into  master

Fixes #4017
Michael Watters • 5 years ago  
file modified
+4 -1
@@ -945,9 +945,12 @@

              self.repo = pygit2.Repository(self.repopath)

  

          # Make sure that all remote refs are mapped to local ones.

+         headname = None

+         if not self.repo.is_empty and not self.repo.head_is_unborn:

+             headname = self.repo.head.shorthand

          for branchname in self.repo.branches.remote:

              localname = branchname.replace("origin/", "")

-             if localname in ("master", "HEAD"):

+             if localname in (headname, "HEAD"):

                  # This gets checked out by default

                  continue

              branch = self.repo.branches.remote.get(branchname)

The head name was previously hard coded to master. This causes pull
requests on projects which do not have a master branch to fail.

Fixes #4017

Pull-Request has been closed by wattersmt

5 years ago