lib/danger/request_sources/vsts.rb in danger-5.4.3 vs lib/danger/request_sources/vsts.rb in danger-5.5.0
- old
+ new
@@ -51,19 +51,21 @@
def fetch_details
self.pr_json = @api.fetch_pr_json
end
def setup_danger_branches
+ base_branch = self.pr_json[:targetRefName].sub("refs/heads/", "")
base_commit = self.pr_json[:lastMergeTargetCommit][:commitId]
+ head_branch = self.pr_json[:sourceRefName].sub("refs/heads/", "")
head_commit = self.pr_json[:lastMergeSourceCommit][:commitId]
# Next, we want to ensure that we have a version of the current branch at a known location
- scm.ensure_commitish_exists! base_commit
+ scm.ensure_commitish_exists_on_branch! base_branch, base_commit
self.scm.exec "branch #{EnvironmentManager.danger_base_branch} #{base_commit}"
# OK, so we want to ensure that we have a known head branch, this will always represent
# the head of the PR ( e.g. the most recent commit that will be merged. )
- scm.ensure_commitish_exists! head_commit
+ scm.ensure_commitish_exists_on_branch! head_branch, head_commit
self.scm.exec "branch #{EnvironmentManager.danger_head_branch} #{head_commit}"
end
def organisation
nil