You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/04/22 12:27:38 UTC

[2/9] allura git commit: [#7836] ticket:739 Fetch target branch before finding merge base

[#7836] ticket:739 Fetch target branch before finding merge base

Because if we don't, we get 0 commits if target branch name and source branch
name are the same, even if branches actually differ.


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/23028fd6
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/23028fd6
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/23028fd6

Branch: refs/heads/ib/7836
Commit: 23028fd6fbdeb3122df010b7444f4ebcc2798a28
Parents: 3364dd7
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 5 16:34:20 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Apr 22 09:44:41 2015 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/23028fd6/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 5994cd2..a0f3f5a 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -632,12 +632,9 @@ class GitImplementation(M.RepositoryImplementation):
         }
 
     def merge_base(self, mr):
-        # We don't need to fetch latest commits from target branch here,
-        # because merge base will always be a commit that both repos have
-        # seen
-        return self._git.git.merge_base(
-            mr.downstream.commit_id,
-            mr.target_branch)
+        g = self._git.git
+        g.fetch(mr.app.repo.full_fs_path, mr.target_branch)
+        return g.merge_base(mr.downstream.commit_id, 'FETCH_HEAD')
 
 
 class _OpenedGitBlob(object):