allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/9] allura git commit: [#7836] ticket:739 Fetch target branch before finding merge base
Date Wed, 20 May 2015 21:37:35 GMT
[#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/0e365071
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0e365071
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0e365071

Branch: refs/heads/master
Commit: 0e365071cf76e24727fd5e2ade6c08a3df2bea17
Parents: a96649c
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Mar 5 16:34:20 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed May 20 19:43:16 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/0e365071/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):


Mime
View raw message